Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity#start()
The following examples show how to use
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EvaluateStartConditionCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected ProcessInstance instantiateProcess(CommandContext commandContext, ConditionHandlerResult result) { ProcessDefinitionEntity processDefinitionEntity = result.getProcessDefinition(); ActivityImpl startEvent = processDefinitionEntity.findActivity(result.getActivity().getActivityId()); ExecutionEntity processInstance = processDefinitionEntity.createProcessInstance(builder.getBusinessKey(), startEvent); processInstance.start(builder.getVariables()); return processInstance; }
Example 2
Source File: StartProcessInstanceCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public ProcessInstanceWithVariables execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinition = new GetDeployedProcessDefinitionCmd(instantiationBuilder, false).execute(commandContext); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateProcessInstance(processDefinition); } // Start the process instance ExecutionEntity processInstance = processDefinition.createProcessInstance(instantiationBuilder.getBusinessKey(), instantiationBuilder.getCaseInstanceId()); if (instantiationBuilder.getTenantId() != null) { processInstance.setTenantId(instantiationBuilder.getTenantId()); } final ExecutionVariableSnapshotObserver variablesListener = new ExecutionVariableSnapshotObserver(processInstance); processInstance.start(instantiationBuilder.getVariables()); commandContext.getOperationLogManager().logProcessInstanceOperation( UserOperationLogEntry.OPERATION_TYPE_CREATE, processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getProcessDefinition().getKey(), Collections.singletonList(PropertyChange.EMPTY_CHANGE)); return new ProcessInstanceWithVariablesImpl(processInstance, variablesListener.getVariables()); }
Example 3
Source File: SubmitStartFormCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public ProcessInstance execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); ensureNotNull("No process definition found for id = '" + processDefinitionId + "'", "processDefinition", processDefinition); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateProcessInstance(processDefinition); } ExecutionEntity processInstance = null; if (businessKey != null) { processInstance = processDefinition.createProcessInstance(businessKey); } else { processInstance = processDefinition.createProcessInstance(); } // if the start event is async, we have to set the variables already here // since they are lost after the async continuation otherwise // see CAM-2828 if (processDefinition.getInitial().isAsyncBefore()) { // avoid firing history events processInstance.setStartContext(new ProcessInstanceStartContext(processInstance.getActivity())); FormPropertyHelper.initFormPropertiesOnScope(variables, processInstance); processInstance.start(); } else { processInstance.startWithFormProperties(variables); } return processInstance; }
Example 4
Source File: AbstractCorrelateMessageCmd.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected ProcessInstance instantiateProcess(CommandContext commandContext, CorrelationHandlerResult correlationResult) { ProcessDefinitionEntity processDefinitionEntity = correlationResult.getProcessDefinitionEntity(); ActivityImpl messageStartEvent = processDefinitionEntity.findActivity(correlationResult.getStartEventActivityId()); ExecutionEntity processInstance = processDefinitionEntity.createProcessInstance(builder.getBusinessKey(), messageStartEvent); if (variablesEnabled) { variablesListener = new ExecutionVariableSnapshotObserver(processInstance, false, deserializeVariableValues); } VariableMap startVariables = resolveStartVariables(); processInstance.start(startVariables); return processInstance; }