コード例 #1
0
 public virtual void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition)
 {
     if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_END, null))
     {
         processDefinition.addBuiltInListener(PvmEvent.EVENTNAME_END, PROCESS_INSTANCE_END_LISTENER);
     }
 }
コード例 #2
0
 protected internal virtual void addCasePlanModelHandlers(CmmnActivity caseActivity)
 {
     if (caseActivity != null)
     {
         if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_INSTANCE_CREATE, null))
         {
             foreach (string @event in ItemHandler.CASE_PLAN_MODEL_CREATE_EVENTS)
             {
                 caseActivity.addBuiltInListener(@event, CASE_INSTANCE_CREATE_LISTENER);
             }
         }
         if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_INSTANCE_UPDATE, null))
         {
             foreach (string @event in ItemHandler.CASE_PLAN_MODEL_UPDATE_EVENTS)
             {
                 caseActivity.addBuiltInListener(@event, CASE_INSTANCE_UPDATE_LISTENER);
             }
         }
         if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_INSTANCE_CLOSE, null))
         {
             foreach (string @event in ItemHandler.CASE_PLAN_MODEL_CLOSE_EVENTS)
             {
                 caseActivity.addBuiltInListener(@event, CASE_INSTANCE_CLOSE_LISTENER);
             }
         }
     }
 }
コード例 #3
0
        // helper /////////////////////////////////////////////////////////

        protected internal virtual bool isHistoryEventProduced(HistoryEventType eventType, Job job)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = configuration.HistoryLevel;

            return(historyLevel.isHistoryEventProduced(eventType, job));
        }
コード例 #4
0
        protected internal virtual HistoryEvent createHistoryEvent(DmnDecisionEvaluationEvent evaluationEvent)
        {
            DmnDecision decisionTable = evaluationEvent.DecisionResult.Decision;

            if (isDeployedDecisionTable(decisionTable) && historyLevel.isHistoryEventProduced(HistoryEventTypes.DMN_DECISION_EVALUATE, decisionTable))
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.camunda.bpm.engine.impl.context.CoreExecutionContext<? extends org.camunda.bpm.engine.impl.core.instance.CoreExecution> executionContext = org.camunda.bpm.engine.impl.context.Context.getCoreExecutionContext();
                CoreExecutionContext <CoreExecution> executionContext = Context.CoreExecutionContext;
                if (executionContext != null)
                {
                    CoreExecution coreExecution = executionContext.Execution;

                    if (coreExecution is ExecutionEntity)
                    {
                        ExecutionEntity execution = (ExecutionEntity)coreExecution;
                        return(eventProducer.createDecisionEvaluatedEvt(execution, evaluationEvent));
                    }
                    else if (coreExecution is CaseExecutionEntity)
                    {
                        CaseExecutionEntity caseExecution = (CaseExecutionEntity)coreExecution;
                        return(eventProducer.createDecisionEvaluatedEvt(caseExecution, evaluationEvent));
                    }
                }

                return(eventProducer.createDecisionEvaluatedEvt(evaluationEvent));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void fireHistoricIdentityLinkEvent(final org.camunda.bpm.engine.impl.history.event.HistoryEventType eventType)
        public virtual void fireHistoricIdentityLinkEvent(HistoryEventType eventType)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            HistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(eventType, this))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, eventType));
            }
        }
コード例 #6
0
        protected internal virtual void fireFormPropertyHistoryEvents(VariableMap properties, VariableScope variableScope)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl processEngineConfiguration = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration();
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.FORM_PROPERTY_UPDATE, variableScope))
            {
                // fire history events
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity executionEntity;
                ExecutionEntity executionEntity;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String taskId;
                string taskId;
                if (variableScope is ExecutionEntity)
                {
                    executionEntity = (ExecutionEntity)variableScope;
                    taskId          = null;
                }
                else if (variableScope is TaskEntity)
                {
                    TaskEntity task = (TaskEntity)variableScope;
                    executionEntity = task.getExecution();
                    taskId          = task.Id;
                }
                else
                {
                    executionEntity = null;
                    taskId          = null;
                }

                if (executionEntity != null)
                {
                    foreach (String variableName in properties.Keys)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.variable.value.TypedValue value = properties.getValueTyped(variableName);
                        TypedValue value = properties.getValueTyped(variableName);

                        // NOTE: SerializableValues are never stored as form properties
                        if (!(value is SerializableValue) && value.Value != null && value.Value is String)
                        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String stringValue = (String) value.getValue();
                            string stringValue = (String)value.Value;

                            HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, executionEntity, taskId, stringValue));
                        }
                    }
                }
            }
        }
コード例 #7
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void completeHistoricBatch(final org.camunda.bpm.engine.impl.batch.BatchEntity batch)
        public virtual void completeHistoricBatch(BatchEntity batch)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.BATCH_END, batch))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this, batch));
            }
        }
コード例 #8
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected void migrateActivityInstanceHistory(final org.camunda.bpm.engine.delegate.DelegateExecution execution)
        protected internal virtual void migrateActivityInstanceHistory(DelegateExecution execution)
        {
            HistoryLevel historyLevel = Context.ProcessEngineConfiguration.HistoryLevel;

            if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_MIGRATE, this))
            {
                return;
            }

            HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this));
        }
コード例 #9
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void createHistoricTask(final TaskEntity task)
        public virtual void createHistoricTask(TaskEntity task)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, task))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass3(this, task));
            }
        }
コード例 #10
0
        public virtual void fireHistoricCaseActivityInstanceUpdate()
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE, this))
            {
                CmmnHistoryEventProducer eventProducer = configuration.CmmnHistoryEventProducer;
                HistoryEventHandler      eventHandler  = configuration.HistoryEventHandler;

                HistoryEvent @event = eventProducer.createCaseActivityInstanceUpdateEvt(this);
                eventHandler.handleEvent(@event);
            }
        }
コード例 #11
0
        public virtual void triggerHistoryEvent(IList <ProcessInstance> subProcesslist)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = configuration.HistoryLevel;

            foreach (ProcessInstance processInstance in subProcesslist)
            {
                // TODO: This smells bad, as the rest of the history is done via the
                // ParseListener
                if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance))
                {
                    HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this));
                }
            }
        }
コード例 #12
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void markTaskInstanceEnded(String taskId, final String deleteReason)
        public virtual void markTaskInstanceEnded(string taskId, string deleteReason)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final TaskEntity taskEntity = org.camunda.bpm.engine.impl.context.Context.getCommandContext().getDbEntityManager().selectById(TaskEntity.class, taskId);
            TaskEntity taskEntity = Context.CommandContext.DbEntityManager.selectById(typeof(TaskEntity), taskId);

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_COMPLETE, taskEntity))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this, deleteReason, taskEntity));
            }
        }
コード例 #13
0
        protected internal override void triggerHistoryEvent(CommandContext commandContext)
        {
            HistoryLevel            historyLevel            = commandContext.ProcessEngineConfiguration.HistoryLevel;
            IList <ProcessInstance> updatedProcessInstances = obtainProcessInstances(commandContext);

            //suspension state is not updated synchronously
            if (NewSuspensionState != null && updatedProcessInstances != null)
            {
                foreach (ProcessInstance processInstance in updatedProcessInstances)
                {
                    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance))
                    {
                        HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this));
                    }
                }
            }
        }
コード例 #14
0
        public virtual Void execute(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl configuration = commandContext.ProcessEngineConfiguration;

            // check that the new process definition is just another version of the same
            // process definition that the process instance is using
            ExecutionManager executionManager = commandContext.ExecutionManager;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity processInstance = executionManager.findExecutionById(processInstanceId);
            ExecutionEntity processInstance = executionManager.findExecutionById(processInstanceId);

            if (processInstance == null)
            {
                throw new ProcessEngineException("No process instance found for id = '" + processInstanceId + "'.");
            }
            else if (!processInstance.ProcessInstanceExecution)
            {
                throw new ProcessEngineException("A process instance id is required, but the provided id " + "'" + processInstanceId + "' " + "points to a child execution of process instance " + "'" + processInstance.ProcessInstanceId + "'. " + "Please invoke the " + this.GetType().Name + " with a root execution id.");
            }
            ProcessDefinitionImpl currentProcessDefinitionImpl = processInstance.getProcessDefinition();

            DeploymentCache         deploymentCache = configuration.DeploymentCache;
            ProcessDefinitionEntity currentProcessDefinition;

            if (currentProcessDefinitionImpl is ProcessDefinitionEntity)
            {
                currentProcessDefinition = (ProcessDefinitionEntity)currentProcessDefinitionImpl;
            }
            else
            {
                currentProcessDefinition = deploymentCache.findDeployedProcessDefinitionById(currentProcessDefinitionImpl.Id);
            }

            ProcessDefinitionEntity newProcessDefinition = deploymentCache.findDeployedProcessDefinitionByKeyVersionAndTenantId(currentProcessDefinition.Key, processDefinitionVersion, currentProcessDefinition.TenantId);

            validateAndSwitchVersionOfExecution(commandContext, processInstance, newProcessDefinition);

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, processInstance));
            }

            // switch all sub-executions of the process instance to the new process definition version
            IList <ExecutionEntity> childExecutions = executionManager.findExecutionsByProcessInstanceId(processInstanceId);

            foreach (ExecutionEntity executionEntity in childExecutions)
            {
                validateAndSwitchVersionOfExecution(commandContext, executionEntity, newProcessDefinition);
            }

            // switch all jobs to the new process definition version
            IList <JobEntity>           jobs = commandContext.JobManager.findJobsByProcessInstanceId(processInstanceId);
            IList <JobDefinitionEntity> currentJobDefinitions    = commandContext.JobDefinitionManager.findByProcessDefinitionId(currentProcessDefinition.Id);
            IList <JobDefinitionEntity> newVersionJobDefinitions = commandContext.JobDefinitionManager.findByProcessDefinitionId(newProcessDefinition.Id);

            IDictionary <string, string> jobDefinitionMapping = getJobDefinitionMapping(currentJobDefinitions, newVersionJobDefinitions);

            foreach (JobEntity jobEntity in jobs)
            {
                switchVersionOfJob(jobEntity, newProcessDefinition, jobDefinitionMapping);
            }

            // switch all incidents to the new process definition version
            IList <IncidentEntity> incidents = commandContext.IncidentManager.findIncidentsByProcessInstance(processInstanceId);

            foreach (IncidentEntity incidentEntity in incidents)
            {
                switchVersionOfIncident(commandContext, incidentEntity, newProcessDefinition);
            }

            // add an entry to the op log
            PropertyChange change = new PropertyChange("processDefinitionVersion", currentProcessDefinition.Version, processDefinitionVersion);

            commandContext.OperationLogManager.logProcessInstanceOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE, processInstanceId, null, null, Collections.singletonList(change));

            return(null);
        }