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!
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="variable"></param>
        /// <param name="sourceActivityExecution"></param>
        /// <param name="useActivityId"></param>
        public virtual void RecordHistoricDetailVariableCreate(IVariableInstanceEntity variable, IExecutionEntity sourceActivityExecution, bool useActivityId)
        {
            if (IsHistoryLevelAtLeast(HistoryLevel.FULL))
            {
                IHistoricDetailVariableInstanceUpdateEntity historicVariableUpdate = HistoricDetailEntityManager.CopyAndInsertHistoricDetailVariableInstanceUpdateEntity(variable);

                if (useActivityId && sourceActivityExecution != null)
                {
                    IHistoricActivityInstanceEntity historicActivityInstance = FindActivityInstance(sourceActivityExecution, false, false);
                    if (historicActivityInstance != null)
                    {
                        historicVariableUpdate.ActivityInstanceId = historicActivityInstance.Id;
                    }
                }
            }
        }
        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);
                }
            }
        }