public virtual void ParseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) { addActivityHandlers(activity); if (HistoryLevel.IsHistoryEventProduced(HistoryEventTypes.TaskInstanceCreate, null)) { var taskDefinition = ((UserTaskActivityBehavior)activity.ActivityBehavior).TaskDefinition; taskDefinition.AddBuiltInTaskListener(TaskListenerFields.EventnameAssignment, UserTaskAssignmentHandler); taskDefinition.AddBuiltInTaskListener(TaskListenerFields.EventnameCreate, UserTaskIdHandler); } }
// helper ///////////////////////////////////////////////////////// protected internal virtual bool IsHistoryEventProduced(HistoryEventTypes eventType, IExternalTask externalTask) { ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration; IHistoryLevel historyLevel = configuration.HistoryLevel; return(historyLevel.IsHistoryEventProduced(eventType, externalTask)); }
protected internal virtual HistoryEvent CreateHistoryEvent(IDmnDecisionEvaluationEvent evaluationEvent) { var decisionTable = evaluationEvent.DecisionResult.Decision; if (IsDeployedDecisionTable(decisionTable) && HistoryLevel.IsHistoryEventProduced(HistoryEventTypes.DmnDecisionEvaluate, 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(); var executionContext = Context.CoreExecutionContext; if (executionContext != null) { //var coreExecution = executionContext.Execution; var coreExecution = executionContext.GetExecution <CoreExecution>(); //if (coreExecution is ExecutionEntity) //{ // var execution = (ExecutionEntity) coreExecution; // return eventProducer.createDecisionEvaluatedEvt(execution, evaluationEvent); //} //if (coreExecution is CaseExecutionEntity) //{ // var caseExecution = (CaseExecutionEntity) coreExecution; // return eventProducer.createDecisionEvaluatedEvt(caseExecution, evaluationEvent); //} } return(EventProducer.CreateDecisionEvaluatedEvt(evaluationEvent)); } return(null); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: //ORIGINAL LINE: public void createHistoricTask(final TaskEntity task) public virtual void CreateHistoricTask(TaskEntity task) { ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration; IHistoryLevel historyLevel = configuration.HistoryLevel; if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.TaskInstanceCreate, task)) { HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper3(this, task)); } }
protected internal virtual void FireHistoricIncidentEvent(HistoryEventTypes eventType) { ProcessEngineConfigurationImpl processEngineConfiguration = context.Impl.Context.ProcessEngineConfiguration; IHistoryLevel historyLevel = processEngineConfiguration.HistoryLevel; if (historyLevel.IsHistoryEventProduced(eventType, this)) { HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this, eventType)); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed 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.Impl.Context.ProcessEngineConfiguration; IHistoryLevel historyLevel = configuration.HistoryLevel; if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.BatchEnd, batch)) { HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper2(this, batch)); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: //ORIGINAL LINE: public void markTaskInstanceEnded(String taskId, final String deleteReason) public virtual void MarkTaskInstanceEnded(string taskId, string deleteReason) { ProcessEngineConfigurationImpl configuration = context.Impl.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.Impl.Context.CommandContext.DbEntityManager.SelectById< TaskEntity>(typeof(TaskEntity), taskId); TaskEntity taskEntity = taskManager.FindTaskById(taskId); IHistoryLevel historyLevel = configuration.HistoryLevel; if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.TaskInstanceComplete, taskEntity)) { HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper2(this, deleteReason, taskEntity)); } }
public virtual object Execute(CommandContext commandContext) { var configuration = commandContext.ProcessEngineConfiguration; //check that the new process definition is just another version of the same //process definition that the process instance is using IExecutionManager executionManager = commandContext.ExecutionManager; ExecutionEntity processInstance = executionManager.FindExecutionById(_processInstanceId); if (processInstance == null) { throw new ProcessEngineException("No process instance found for id = '" + _processInstanceId + "'."); } else if (!processInstance.IsProcessInstanceExecution) { 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.ProcessDefinition; 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); IHistoryLevel historyLevel = configuration.HistoryLevel; if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.ProcessInstanceUpdate, 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(UserOperationLogEntryFields.OperationTypeModifyProcessInstance, _processInstanceId, null, null, new List <PropertyChange>() { change }); return(null); }