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); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: protected org.camunda.bpm.engine.impl.runtime.MessageCorrelationResultImpl createMessageCorrelationResult(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext, final org.camunda.bpm.engine.impl.runtime.CorrelationHandlerResult handlerResult) protected internal virtual MessageCorrelationResultImpl createMessageCorrelationResult(CommandContext commandContext, CorrelationHandlerResult handlerResult) { MessageCorrelationResultImpl resultWithVariables = new MessageCorrelationResultImpl(handlerResult); if (MessageCorrelationResultType.Execution.Equals(handlerResult.ResultType)) { ExecutionEntity execution = findProcessInstanceExecution(commandContext, handlerResult); if (variablesEnabled && execution != null) { variablesListener = new ExecutionVariableSnapshotObserver(execution, false, deserializeVariableValues); } triggerExecution(commandContext, handlerResult); } else { ProcessInstance instance = instantiateProcess(commandContext, handlerResult); resultWithVariables.ProcessInstance = instance; } if (variablesListener != null) { resultWithVariables.Variables = variablesListener.Variables; } return(resultWithVariables); }
protected internal virtual void handleEvent(VariableEvent @event) { AbstractVariableScope sourceScope = @event.SourceScope; if (sourceScope is ExecutionEntity) { addEventToScopeExecution((ExecutionEntity)sourceScope, @event); } else if (sourceScope is TaskEntity) { TaskEntity task = (TaskEntity)sourceScope; ExecutionEntity execution = task.getExecution(); if (execution != null) { addEventToScopeExecution(execution, @event); } } else if (sourceScope.ParentVariableScope is ExecutionEntity) { addEventToScopeExecution((ExecutionEntity)sourceScope.ParentVariableScope, @event); } else { throw new ProcessEngineException("BPMN execution scope expected"); } }
public virtual Void execute(CommandContext commandContext) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.runtime.Incident incident = commandContext.getIncidentManager().findIncidentById(incidentId); Incident incident = commandContext.IncidentManager.findIncidentById(incidentId); EnsureUtil.ensureNotNull(typeof(NotFoundException), "Cannot find an incident with id '" + incidentId + "'", "incident", incident); if (incident.IncidentType.Equals("failedJob") || incident.IncidentType.Equals("failedExternalTask")) { throw new BadUserRequestException("Cannot resolve an incident of type " + incident.IncidentType); } EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "", "executionId", incident.ExecutionId); ExecutionEntity execution = commandContext.ExecutionManager.findExecutionById(incident.ExecutionId); EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Cannot find an execution for an incident with id '" + incidentId + "'", "execution", execution); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkUpdateProcessInstance(execution); } commandContext.OperationLogManager.logProcessInstanceOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RESOLVE, execution.ProcessInstanceId, execution.ProcessDefinitionId, null, Collections.singletonList(new PropertyChange("incidentId", null, incidentId))); execution.resolveIncident(incidentId); return null; }
public override void attachState(MigratingScopeInstance targetActivityInstance) { Parent = targetActivityInstance; ExecutionEntity representativeExecution = targetActivityInstance.resolveRepresentativeExecution(); eventSubscription.Execution = representativeExecution; }
public static CorrelationHandlerResult matchedExecution(ExecutionEntity executionEntity) { CorrelationHandlerResult messageCorrelationResult = new CorrelationHandlerResult(); messageCorrelationResult.resultType = MessageCorrelationResultType.Execution; messageCorrelationResult.executionEntity = executionEntity; return(messageCorrelationResult); }
protected internal virtual void addEventToScopeExecution(ExecutionEntity sourceScope, VariableEvent @event) { // ignore events of variables that are not set in an execution ExecutionEntity sourceExecution = sourceScope; ExecutionEntity scopeExecution = sourceExecution.Scope ? sourceExecution : sourceExecution.Parent; scopeExecution.delayEvent((ExecutionEntity)targetScope, @event); }
public override long?getSpecificPriority(ExecutionEntity execution, ExternalTaskActivityBehavior param, string jobDefinitionId) { ParameterValueProvider priorityProvider = param.PriorityValueProvider; if (priorityProvider != null) { return(evaluateValueProvider(priorityProvider, execution, "")); } return(null); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception public virtual void execute(ActivityExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity)execution; PriorityProvider <ExternalTaskActivityBehavior> provider = Context.ProcessEngineConfiguration.ExternalTaskPriorityProvider; long priority = provider.determinePriority(executionEntity, this, null); string topic = (string)topicNameValueProvider.getValue(executionEntity); ExternalTaskEntity.createAndInsert(executionEntity, topic, priority); }
protected internal virtual ExecutionEntity findSuperExecution(ExecutionEntity parentScopeExecution, ExecutionEntity topmostCancellableExecution) { ExecutionEntity superExecution = null; if (parentScopeExecution == null) { superExecution = topmostCancellableExecution.getSuperExecution(); } return(superExecution); }
public Void execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.ExecutionManager.findExecutionById(processInstanceId); VariableInstanceEntity varInstance = (VariableInstanceEntity)execution.getVariableInstance(outerInstance.VARIABLE_NAME); HistoricVariableInstanceEntity historicVariableInstance = commandContext.HistoricVariableInstanceManager.findHistoricVariableInstanceByVariableInstanceId(varInstance.Id); historicByteArrayId[0] = historicVariableInstance.ByteArrayValueId; return(null); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: protected org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity determineSourceInstanceExecution(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) protected internal override ExecutionEntity determineSourceInstanceExecution(CommandContext commandContext) { ActivityInstance instance = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext)); TransitionInstance instanceToCancel = findTransitionInstance(instance, transitionInstanceId); EnsureUtil.ensureNotNull(typeof(NotValidException), describeFailure("Transition instance '" + transitionInstanceId + "' does not exist"), "transitionInstance", instanceToCancel); ExecutionEntity transitionExecution = commandContext.ExecutionManager.findExecutionById(instanceToCancel.ExecutionId); return(transitionExecution); }
protected internal virtual long?getActivityPriority <T1>(ExecutionEntity execution, JobDeclaration <T1> jobDeclaration) { if (jobDeclaration != null) { ParameterValueProvider priorityProvider = jobDeclaration.JobPriorityProvider; if (priorityProvider != null) { return(evaluateValueProvider(priorityProvider, execution, describeContext(jobDeclaration, execution))); } } return(null); }
public virtual void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { ExecutionEntity execution = migratingInstance.resolveRepresentativeExecution(); foreach (ExternalTaskEntity task in execution.ExternalTasks) { MigratingExternalTaskInstance migratingTask = new MigratingExternalTaskInstance(task, migratingInstance); migratingInstance.addMigratingDependentInstance(migratingTask); parseContext.consume(task); parseContext.submit(migratingTask); } }
public virtual void execute(EventSubscriptionJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId) { // lookup subscription: string eventSubscriptionId = configuration.EventSubscriptionId; EventSubscriptionEntity eventSubscription = commandContext.EventSubscriptionManager.findEventSubscriptionById(eventSubscriptionId); // if event subscription is null, ignore if (eventSubscription != null) { eventSubscription.eventReceived(null, false); } }
public virtual void execute(BpmnStackTrace stackTrace) { if (operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CANCEL_SCOPE && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_INTERRUPT_SCOPE && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CONCURRENT && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.DELETE_CASCADE) { // execution might be replaced in the meantime: ExecutionEntity replacedBy = execution.ReplacedBy; if (replacedBy != null) { execution = replacedBy; } } //execution was canceled for example via terminate end event if (execution.Canceled && (operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.TRANSITION_NOTIFY_LISTENER_END || operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_NOTIFY_LISTENER_END)) { return; } // execution might have ended in the meanwhile if (execution.Ended && (operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.TRANSITION_NOTIFY_LISTENER_TAKE || operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CREATE_SCOPE)) { return; } ProcessApplicationReference currentPa = Context.CurrentProcessApplication; if (currentPa != null) { applicationContextName = currentPa.Name; } activityId = execution.ActivityId; activityName = execution.CurrentActivityName; stackTrace.add(this); try { Context.ExecutionContext = execution; if (!performAsync) { LOG.debugExecutingAtomicOperation(operation, execution); operation.execute(execution); } else { execution.scheduleAtomicOperationAsync(this); } } finally { Context.removeExecutionContext(); } }
public virtual FormProperty createFormProperty(ExecutionEntity execution) { FormPropertyImpl formProperty = new FormPropertyImpl(this); object modelValue = null; if (execution != null) { if (!string.ReferenceEquals(variableName, null) || variableExpression == null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String varName = variableName != null ? variableName : id; string varName = !string.ReferenceEquals(variableName, null) ? variableName : id; if (execution.hasVariable(varName)) { modelValue = execution.getVariable(varName); } else if (defaultExpression != null) { modelValue = defaultExpression.getValue(execution); } } else { modelValue = variableExpression.getValue(execution); } } else { // Execution is null, the form-property is used in a start-form. Default value // should be available (ACT-1028) even though no execution is available. if (defaultExpression != null) { modelValue = defaultExpression.getValue(StartProcessVariableScope.SharedInstance); } } if (modelValue is string) { formProperty.Value = (string)modelValue; } else if (type != null) { string formValue = type.convertModelValueToFormValue(modelValue); formProperty.Value = formValue; } else if (modelValue != null) { formProperty.Value = modelValue.ToString(); } return(formProperty); }
public virtual void attachState(MigratingScopeInstance owningInstance) { ExecutionEntity representativeExecution = owningInstance.resolveRepresentativeExecution(); representativeExecution.addTask(userTask); foreach (VariableInstanceEntity variable in userTask.VariablesInternal) { variable.Execution = representativeExecution; } userTask.setExecution(representativeExecution); }
public virtual void execute(TimerJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId) { string activityId = configuration.TimerElementKey; ActivityImpl eventSubprocessActivity = execution.getProcessDefinition().findActivity(activityId); if (eventSubprocessActivity != null) { execution.executeEventHandlerActivity(eventSubprocessActivity); } else { throw new ProcessEngineException("Error while triggering event subprocess using timer start event: cannot find activity with id '" + configuration + "'."); } }
public virtual void attachState(MigratingScopeInstance owningActivityInstance) { ExecutionEntity representativeExecution = owningActivityInstance.resolveRepresentativeExecution(); ScopeImpl currentScope = owningActivityInstance.CurrentScope; ExecutionEntity newOwningExecution = representativeExecution; if (currentScope.Scope && isConcurrentLocalInParentScope) { newOwningExecution = representativeExecution.Parent; } newOwningExecution.addVariableInternal(variable); }
public virtual void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { ActivityImpl callActivity = (ActivityImpl)migratingInstance.SourceScope; // A call activity is typically scope and since we guarantee stability of scope executions during migration, // the superExecution link does not have to be maintained during migration. // There are some exceptions, though: A multi-instance call activity is not scope and therefore // does not have a dedicated scope execution. In this case, the link to the super execution // must be maintained throughout migration if (!callActivity.Scope) { ExecutionEntity callActivityExecution = migratingInstance.resolveRepresentativeExecution(); ExecutionEntity calledProcessInstance = callActivityExecution.getSubProcessInstance(); migratingInstance.addMigratingDependentInstance(new MigratingCalledProcessInstance(calledProcessInstance)); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: protected org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity determineSourceInstanceExecution(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) protected internal override ExecutionEntity determineSourceInstanceExecution(CommandContext commandContext) { ExecutionEntity processInstance = commandContext.ExecutionManager.findExecutionById(processInstanceId); // rebuild the mapping because the execution tree changes with every iteration ActivityExecutionTreeMapping mapping = new ActivityExecutionTreeMapping(commandContext, processInstanceId); ActivityInstance instance = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext)); ActivityInstance instanceToCancel = findActivityInstance(instance, activityInstanceId); EnsureUtil.ensureNotNull(typeof(NotValidException), describeFailure("Activity instance '" + activityInstanceId + "' does not exist"), "activityInstance", instanceToCancel); ExecutionEntity scopeExecution = getScopeExecutionForActivityInstance(processInstance, mapping, instanceToCancel); return(scopeExecution); }
public virtual void execute(BatchMonitorJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId) { string batchId = configuration.BatchId; BatchEntity batch = commandContext.BatchManager.findBatchById(configuration.BatchId); ensureNotNull("Batch with id '" + batchId + "' cannot be found", "batch", batch); bool completed = batch.Completed; if (!completed) { batch.createMonitorJob(true); } else { batch.delete(false); } }
protected internal virtual ProcessInstance instantiateProcess(CommandContext commandContext, CorrelationHandlerResult correlationResult) { ProcessDefinitionEntity processDefinitionEntity = correlationResult.ProcessDefinitionEntity; ActivityImpl messageStartEvent = processDefinitionEntity.findActivity(correlationResult.StartEventActivityId); ExecutionEntity processInstance = processDefinitionEntity.createProcessInstance(builder.BusinessKey, messageStartEvent); if (variablesEnabled) { variablesListener = new ExecutionVariableSnapshotObserver(processInstance, false, deserializeVariableValues); } processInstance.VariablesLocal = builder.PayloadProcessInstanceVariablesLocal; processInstance.start(builder.PayloadProcessInstanceVariables); return(processInstance); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception public virtual void execute(DelegateExecution execution) { string existingId = execution.Id; // insert an execution referencing the current execution ExecutionEntity newExecution = new ExecutionEntity(); newExecution.Id = "someId"; newExecution.ParentId = existingId; DbEntityOperation insertOperation = new DbEntityOperation(); insertOperation.OperationType = DbOperationType.INSERT; insertOperation.Entity = newExecution; Context.CommandContext.DbSqlSession.executeDbOperation(insertOperation); }
protected internal virtual void checkAuthorization(CorrelationHandlerResult correlation) { CommandContext commandContext = Context.CommandContext; foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { if (MessageCorrelationResultType.Execution.Equals(correlation.ResultType)) { ExecutionEntity execution = correlation.ExecutionEntity; checker.checkUpdateProcessInstanceById(execution.ProcessInstanceId); } else { ProcessDefinitionEntity definition = correlation.ProcessDefinitionEntity; checker.checkCreateProcessInstance(definition); } } }
protected internal override long?getSpecificPriority <T1>(ExecutionEntity execution, JobDeclaration <T1> param, string jobDefinitionId) { long?specificPriority = null; JobDefinitionEntity jobDefinition = getJobDefinitionFor(jobDefinitionId); if (jobDefinition != null) { specificPriority = jobDefinition.OverridingJobPriority; } if (specificPriority == null) { ParameterValueProvider priorityProvider = param.JobPriorityProvider; if (priorityProvider != null) { specificPriority = evaluateValueProvider(priorityProvider, execution, describeContext(param, execution)); } } return(specificPriority); }
public static void handleChildRemovalInScope(ExecutionEntity removedExecution) { ActivityImpl activity = removedExecution.getActivity(); if (activity == null) { if (removedExecution.getSuperExecution() != null) { removedExecution = removedExecution.getSuperExecution(); activity = removedExecution.getActivity(); if (activity == null) { return; } } else { return; } } ScopeImpl flowScope = activity.FlowScope; PvmExecutionImpl scopeExecution = removedExecution.getParentScopeExecution(false); PvmExecutionImpl executionInParentScope = removedExecution.Concurrent ? removedExecution : removedExecution.Parent; if (flowScope.ActivityBehavior != null && flowScope.ActivityBehavior is ModificationObserverBehavior) { // let child removal be handled by the scope itself ModificationObserverBehavior behavior = (ModificationObserverBehavior)flowScope.ActivityBehavior; behavior.destroyInnerInstance(executionInParentScope); } else { if (executionInParentScope.Concurrent) { executionInParentScope.remove(); scopeExecution.tryPruneLastConcurrentChild(); scopeExecution.forceUpdate(); } } }
public virtual void notify(DelegateTask task) { // get the event handler //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler historyEventHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getHistoryEventHandler(); HistoryEventHandler historyEventHandler = Context.ProcessEngineConfiguration.HistoryEventHandler; ExecutionEntity execution = ((TaskEntity)task).getExecution(); if (execution != null) { // delegate creation of the history event to the producer HistoryEvent historyEvent = createHistoryEvent(task, execution); if (historyEvent != null) { // pass the event to the handler historyEventHandler.handleEvent(historyEvent); } } }
public virtual void execute(BatchSeedJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId) { string batchId = configuration.BatchId; BatchEntity batch = commandContext.BatchManager.findBatchById(batchId); ensureNotNull("Batch with id '" + batchId + "' cannot be found", "batch", batch); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: BatchJobHandler<?> batchJobHandler = commandContext.getProcessEngineConfiguration().getBatchHandlers().get(batch.getType()); BatchJobHandler <object> batchJobHandler = commandContext.ProcessEngineConfiguration.BatchHandlers[batch.Type]; bool done = batchJobHandler.createJobs(batch); if (!done) { batch.createSeedJob(); } else { // create monitor job initially without due date to // enable rapid completion of simple batches batch.createMonitorJob(false); } }