public override void Delete(KeyValuePair <string, object> id)
        {
            string historicProcessInstanceId = id.Value?.ToString();

            if (HistoryManager.HistoryEnabled)
            {
                if (historicProcessInstanceId == null)
                {
                    return;
                }

                IHistoricProcessInstanceEntity historicProcessInstance = FindById <IHistoricProcessInstanceEntity>(new KeyValuePair <string, object>("id", historicProcessInstanceId));

                HistoricDetailEntityManager.DeleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);
                HistoricVariableInstanceEntityManager.DeleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);
                HistoricActivityInstanceEntityManager.DeleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);
                HistoricTaskInstanceEntityManager.DeleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);
                HistoricIdentityLinkEntityManager.DeleteHistoricIdentityLinksByProcInstance(historicProcessInstanceId);
                CommentEntityManager.DeleteCommentsByProcessInstanceId(historicProcessInstanceId);

                Delete(historicProcessInstance, false);

                // Also delete any sub-processes that may be active (ACT-821)

                IList <IHistoricProcessInstanceEntity> selectList = historicProcessInstanceDataManager.FindHistoricProcessInstancesBySuperProcessInstanceId(historicProcessInstanceId);
                foreach (IHistoricProcessInstanceEntity child in selectList)
                {
                    Delete(new KeyValuePair <string, object>("id", child.Id)); // NEEDS to be by id, to come again through this method!
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="taskId"></param>
        /// <param name="userId"></param>
        /// <param name="groupId"></param>
        /// <param name="type"></param>
        /// <param name="create"></param>
        /// <param name="forceNullUserId"></param>
        public virtual void CreateIdentityLinkComment(string taskId, string userId, string groupId, string type, bool create, bool forceNullUserId)
        {
            if (HistoryEnabled)
            {
                string         authenticatedUserId = Authentication.AuthenticatedUser.Id;
                ICommentEntity comment             = CommentEntityManager.Create();
                comment.UserId = authenticatedUserId;
                comment.Type   = CommentEntityFields.TYPE_EVENT;
                comment.Time   = Clock.CurrentTime;
                comment.TaskId = taskId;
                if (userId is object || forceNullUserId)
                {
                    if (create)
                    {
                        comment.Action = EventFields.ACTION_ADD_USER_LINK;
                    }
                    else
                    {
                        comment.Action = EventFields.ACTION_DELETE_USER_LINK;
                    }
                    comment.MessageParts = new string[] { userId, type };
                }
                else
                {
                    if (create)
                    {
                        comment.Action = EventFields.ACTION_ADD_GROUP_LINK;
                    }
                    else
                    {
                        comment.Action = EventFields.ACTION_DELETE_GROUP_LINK;
                    }
                    comment.MessageParts = new string[] { groupId, type };
                }

                CommentEntityManager.Insert(comment);
            }
        }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="taskId"></param>
 /// <param name="processInstanceId"></param>
 /// <param name="attachmentName"></param>
 /// <param name="create"></param>
 public virtual void CreateAttachmentComment(string taskId, string processInstanceId, string attachmentName, bool create)
 {
     if (HistoryEnabled)
     {
         string         userId  = Authentication.AuthenticatedUser.Id;
         ICommentEntity comment = CommentEntityManager.Create();
         comment.UserId            = userId;
         comment.Type              = CommentEntityFields.TYPE_EVENT;
         comment.Time              = Clock.CurrentTime;
         comment.TaskId            = taskId;
         comment.ProcessInstanceId = processInstanceId;
         if (create)
         {
             comment.Action = EventFields.ACTION_ADD_ATTACHMENT;
         }
         else
         {
             comment.Action = EventFields.ACTION_DELETE_ATTACHMENT;
         }
         comment.MessageParts = new string[] { attachmentName };
         CommentEntityManager.Insert(comment);
     }
 }
        public override void Delete(KeyValuePair <string, object> id)
        {
            if (HistoryManager.HistoryEnabled)
            {
                IHistoricTaskInstanceEntity historicTaskInstance = FindById <IHistoricTaskInstanceEntity>(new KeyValuePair <string, object>("historicTaskInstanceId", id.Value));
                if (historicTaskInstance != null)
                {
                    IList <IHistoricTaskInstanceEntity> subTasks = historicTaskInstanceDataManager.FindHistoricTasksByParentTaskId(historicTaskInstance.Id);
                    foreach (IHistoricTaskInstance subTask in subTasks)
                    {
                        Delete(new KeyValuePair <string, object>("id", subTask.Id));
                    }

                    var sid = id.Value.ToString();
                    HistoricDetailEntityManager.DeleteHistoricDetailsByTaskId(sid);
                    HistoricVariableInstanceEntityManager.DeleteHistoricVariableInstancesByTaskId(sid);
                    CommentEntityManager.DeleteCommentsByTaskId(sid);
                    AttachmentEntityManager.DeleteAttachmentsByTaskId(sid);
                    HistoricIdentityLinkEntityManager.DeleteHistoricIdentityLinksByTaskId(sid);

                    Delete(historicTaskInstance);
                }
            }
        }