示例#1
0
        public virtual void DeleteProcessInstance(string processInstanceId, string deleteReason, bool cascade,
                                                  bool skipCustomListeners, bool externallyTerminated)
        {
            var execution = FindExecutionById(processInstanceId);

            Log.LogDebug("EF删除数据 DeleteProcessInstance:", processInstanceId);
            if (execution == null)
            {
                throw Log.RequestedProcessInstanceNotFoundException(processInstanceId);
            }

            _taskManager.DeleteTasksByProcessInstanceId(processInstanceId, deleteReason, cascade, skipCustomListeners);

            //// delete the execution BEFORE we delete the history, otherwise we will produce orphan HistoricVariableInstance instances
            execution.DeleteCascade(deleteReason, skipCustomListeners, false, externallyTerminated);

            if (cascade)
            {
                _historicProcessInstanceManager.DeleteHistoricProcessInstanceById(processInstanceId);
            }
        }