예제 #1
0
        public virtual Incident execute(CommandContext commandContext)
        {
            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Execution id cannot be null", "executionId", executionId);
            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "incidentType", incidentType);

            ExecutionEntity execution = commandContext.ExecutionManager.findExecutionById(executionId);

            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Cannot find an execution with executionId '" + executionId + "'", "execution", execution);
            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Execution must be related to an activity", "activity", execution.getActivity());

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkUpdateProcessInstance(execution);
            }

            IList <PropertyChange> propertyChanges = new List <PropertyChange>();

            propertyChanges.Add(new PropertyChange("incidentType", null, incidentType));
            propertyChanges.Add(new PropertyChange("configuration", null, configuration));

            commandContext.OperationLogManager.logProcessInstanceOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE_INCIDENT, execution.ProcessInstanceId, execution.ProcessDefinitionId, null, propertyChanges);

            return(execution.createIncident(incidentType, configuration, message));
        }