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!
                }
            }
        }
Пример #2
0
        // Variables related history

        /// <summary>
        ///
        /// </summary>
        /// <param name="variable"></param>
        public virtual void RecordVariableCreate(IVariableInstanceEntity variable)
        {
            // Historic variables
            if (IsHistoryLevelAtLeast(HistoryLevel.ACTIVITY))
            {
                HistoricVariableInstanceEntityManager.CopyAndInsert(variable);
            }
        }
Пример #3
0
        public virtual void RecordVariableRemoved(IVariableInstanceEntity variable)
        {
            if (variable != null && IsHistoryLevelAtLeast(HistoryLevel.ACTIVITY))
            {
                if (!(EntityCache.FindInCache(variable.GetType(), variable.Id) is IHistoricVariableInstanceEntity historicProcessVariable))
                {
                    historicProcessVariable = HistoricVariableInstanceEntityManager.FindHistoricVariableInstanceByVariableInstanceId(variable.Id);
                }

                if (historicProcessVariable != null)
                {
                    HistoricVariableInstanceEntityManager.Delete(historicProcessVariable);
                }
            }
        }
        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);
                }
            }
        }