//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public org.camunda.bpm.engine.runtime.ProcessInstance execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public virtual ProcessInstance execute(CommandContext commandContext) { ensureNotNull("messageName", messageName); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationHandler correlationHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getCorrelationHandler(); CorrelationHandler correlationHandler = Context.ProcessEngineConfiguration.CorrelationHandler; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationSet correlationSet = new org.camunda.bpm.engine.impl.runtime.CorrelationSet(builder); CorrelationSet correlationSet = new CorrelationSet(builder); IList <CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, correlationHandler, correlationSet)); if (correlationResults.Count == 0) { throw new MismatchingMessageCorrelationException(messageName, "No process definition matches the parameters"); } else if (correlationResults.Count > 1) { throw LOG.exceptionCorrelateMessageToSingleProcessDefinition(messageName, correlationResults.Count, correlationSet); } else { CorrelationHandlerResult correlationResult = correlationResults[0]; checkAuthorization(correlationResult); ProcessInstance processInstance = instantiateProcess(commandContext, correlationResult); return(processInstance); } }
protected internal virtual void TriggerExecution(CommandContext commandContext, CorrelationHandlerResult correlationResult) { var executionId = correlationResult.ExecutionEntity.Id; var command = new MessageEventReceivedCmd(MessageName, executionId, Builder.PayloadProcessInstanceVariables, Builder.ExclusiveCorrelation); command.Execute(commandContext); }
protected internal virtual IProcessInstance InstantiateProcess(CommandContext commandContext, CorrelationHandlerResult correlationResult) { var processDefinitionEntity = correlationResult.ProcessDefinitionEntity; ActivityImpl messageStartEvent = (ActivityImpl)processDefinitionEntity.FindActivity(correlationResult.StartEventActivityId); ExecutionEntity processInstance = (ExecutionEntity)processDefinitionEntity.CreateProcessInstance(Builder.BusinessKey, messageStartEvent); processInstance.Start(Builder.PayloadProcessInstanceVariables); return(processInstance); }
protected internal virtual IMessageCorrelationResult CreateMessageCorrelationResult( CommandContext commandContext, CorrelationHandlerResult handlerResult) { var result = new MessageCorrelationResultImpl(handlerResult); if (MessageCorrelationResultType.Execution.Equals(handlerResult.ResultType)) { TriggerExecution(commandContext, handlerResult); } else { var instance = InstantiateProcess(commandContext, handlerResult); result.ProcessInstance = instance; } return(result); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public org.camunda.bpm.engine.impl.runtime.MessageCorrelationResultImpl execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public virtual MessageCorrelationResultImpl execute(CommandContext commandContext) { ensureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.BusinessKey, builder.CorrelationProcessInstanceVariables, builder.ProcessInstanceId); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationHandler correlationHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getCorrelationHandler(); CorrelationHandler correlationHandler = Context.ProcessEngineConfiguration.CorrelationHandler; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationSet correlationSet = new org.camunda.bpm.engine.impl.runtime.CorrelationSet(builder); CorrelationSet correlationSet = new CorrelationSet(builder); CorrelationHandlerResult correlationResult = null; if (startMessageOnly) { IList <CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, correlationHandler, correlationSet)); if (correlationResults.Count == 0) { throw new MismatchingMessageCorrelationException(messageName, "No process definition matches the parameters"); } else if (correlationResults.Count > 1) { throw LOG.exceptionCorrelateMessageToSingleProcessDefinition(messageName, correlationResults.Count, correlationSet); } else { correlationResult = correlationResults[0]; } } else { correlationResult = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass2(this, commandContext, correlationHandler, correlationSet)); if (correlationResult == null) { throw new MismatchingMessageCorrelationException(messageName, "No process definition or execution matches the parameters"); } } // check authorization checkAuthorization(correlationResult); return(createMessageCorrelationResult(commandContext, correlationResult)); }
protected internal virtual void CheckAuthorization(CorrelationHandlerResult correlation) { var commandContext = context.Impl.Context.CommandContext; foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { if (MessageCorrelationResultType.Execution.Equals(correlation.ResultType)) { var execution = correlation.ExecutionEntity; checker.CheckUpdateProcessInstanceById(execution.ProcessInstanceId); } else { var definition = correlation.ProcessDefinitionEntity; checker.CheckCreateProcessInstance(definition); } } }
public virtual IMessageCorrelationResult Execute(CommandContext commandContext) { EnsureUtil.EnsureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", MessageName, Builder.BusinessKey, Builder.CorrelationProcessInstanceVariables, Builder.processInstanceId); var correlationHandler = context.Impl.Context.ProcessEngineConfiguration.CorrelationHandler; var correlationSet = new CorrelationSet(Builder); CorrelationHandlerResult correlationResult = commandContext.RunWithoutAuthorization(() => correlationHandler.CorrelateMessage(commandContext, MessageName, correlationSet)); if (correlationResult == null) { throw new MismatchingMessageCorrelationException(MessageName, "No process definition or execution matches the parameters"); } // check authorization CheckAuthorization(correlationResult); return(CreateMessageCorrelationResult(commandContext, correlationResult)); }