Package org.camunda.bpm.engine.impl
Class ProcessInstantiationBuilderImpl
- java.lang.Object
-
- org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl
-
- All Implemented Interfaces:
ActivityInstantiationBuilder<ProcessInstantiationBuilder>,InstantiationBuilder<ProcessInstantiationBuilder>,ProcessInstantiationBuilder
public class ProcessInstantiationBuilderImpl extends java.lang.Object implements ProcessInstantiationBuilder
Simply wraps a modification builder because their API is equivalent.- Author:
- Thorben Lindhauer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbusinessKeyprotected java.lang.StringcaseInstanceIdprotected CommandExecutorcommandExecutorprotected booleanisProcessDefinitionTenantIdSetprotected ProcessInstanceModificationBuilderImplmodificationBuilderprotected java.lang.StringprocessDefinitionIdprotected java.lang.StringprocessDefinitionKeyprotected java.lang.StringprocessDefinitionTenantIdprotected java.lang.StringtenantId
-
Constructor Summary
Constructors Modifier Constructor Description protectedProcessInstantiationBuilderImpl(CommandExecutor commandExecutor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessInstantiationBuilderbusinessKey(java.lang.String businessKey)Set the business key for the process instanceProcessInstantiationBuildercaseInstanceId(java.lang.String caseInstanceId)Associate a case instance with the process instancestatic ProcessInstantiationBuildercreateProcessInstanceById(CommandExecutor commandExecutor, java.lang.String processDefinitionId)static ProcessInstantiationBuildercreateProcessInstanceByKey(CommandExecutor commandExecutor, java.lang.String processDefinitionKey)ProcessInstanceexecute()Start the process instance.ProcessInstanceexecute(boolean skipCustomListeners, boolean skipIoMappings)Start the process instance.ProcessInstanceWithVariablesexecuteWithVariablesInReturn()Start the process instance.ProcessInstanceWithVariablesexecuteWithVariablesInReturn(boolean skipCustomListeners, boolean skipIoMappings)Start the process instance.java.lang.StringgetBusinessKey()java.lang.StringgetCaseInstanceId()ProcessInstanceModificationBuilderImplgetModificationBuilder()java.lang.StringgetProcessDefinitionId()java.lang.StringgetProcessDefinitionKey()java.lang.StringgetProcessDefinitionTenantId()java.lang.StringgetTenantId()java.util.Map<java.lang.String,java.lang.Object>getVariables()booleanisProcessDefinitionTenantIdSet()ProcessInstantiationBuilderprocessDefinitionTenantId(java.lang.String tenantId)Specify the id of the tenant the process definition belongs to.ProcessInstantiationBuilderprocessDefinitionWithoutTenantId()Specify that the process definition belongs to no tenant.voidsetModificationBuilder(ProcessInstanceModificationBuilderImpl modificationBuilder)ProcessInstantiationBuildersetVariable(java.lang.String name, java.lang.Object value)If an instruction is submitted before then the variable is set when the instruction is executed.ProcessInstantiationBuildersetVariableLocal(java.lang.String name, java.lang.Object value)If an instruction is submitted before then the local variable is set when the instruction is executed.ProcessInstantiationBuildersetVariables(java.util.Map<java.lang.String,java.lang.Object> variables)If an instruction is submitted before then all variables are set when the instruction is executed.ProcessInstantiationBuildersetVariablesLocal(java.util.Map<java.lang.String,java.lang.Object> variables)If an instruction is submitted before then all local variables are set when the instruction is executed.ProcessInstantiationBuilderstartAfterActivity(java.lang.String activityId)Submits an instruction that behaves likeInstantiationBuilder.startTransition(String)and always instantiates the single outgoing sequence flow of the given activity.ProcessInstantiationBuilderstartBeforeActivity(java.lang.String activityId)Submits the instruction:ProcessInstantiationBuilderstartTransition(java.lang.String transitionId)Submits the instruction:ProcessInstantiationBuildertenantId(java.lang.String tenantId)
-
-
-
Field Detail
-
commandExecutor
protected CommandExecutor commandExecutor
-
processDefinitionId
protected java.lang.String processDefinitionId
-
processDefinitionKey
protected java.lang.String processDefinitionKey
-
businessKey
protected java.lang.String businessKey
-
caseInstanceId
protected java.lang.String caseInstanceId
-
tenantId
protected java.lang.String tenantId
-
processDefinitionTenantId
protected java.lang.String processDefinitionTenantId
-
isProcessDefinitionTenantIdSet
protected boolean isProcessDefinitionTenantIdSet
-
modificationBuilder
protected ProcessInstanceModificationBuilderImpl modificationBuilder
-
-
Constructor Detail
-
ProcessInstantiationBuilderImpl
protected ProcessInstantiationBuilderImpl(CommandExecutor commandExecutor)
-
-
Method Detail
-
startBeforeActivity
public ProcessInstantiationBuilder startBeforeActivity(java.lang.String activityId)
Description copied from interface:InstantiationBuilderSubmits the instruction:
Start before the specified activity.
In particular:
- In the parent activity hierarchy, determine the closest existing ancestor activity instance
- Instantiate all parent activities up to the ancestor's activity
- Instantiate and execute the given activity (respects the asyncBefore attribute of the activity)
- Specified by:
startBeforeActivityin interfaceInstantiationBuilder<ProcessInstantiationBuilder>- Parameters:
activityId- the activity to instantiate
-
startAfterActivity
public ProcessInstantiationBuilder startAfterActivity(java.lang.String activityId)
Description copied from interface:InstantiationBuilderSubmits an instruction that behaves likeInstantiationBuilder.startTransition(String)and always instantiates the single outgoing sequence flow of the given activity. Does not consider asyncAfter.- Specified by:
startAfterActivityin interfaceInstantiationBuilder<ProcessInstantiationBuilder>- Parameters:
activityId- the activity for which the outgoing flow should be executed
-
startTransition
public ProcessInstantiationBuilder startTransition(java.lang.String transitionId)
Description copied from interface:InstantiationBuilderSubmits the instruction:
Start a sequence flow.
In particular:
- In the parent activity hierarchy, determine the closest existing ancestor activity instance
- Instantiate all parent activities up to the ancestor's activity
- Execute the given transition (does not consider sequence flow conditions)
- Specified by:
startTransitionin interfaceInstantiationBuilder<ProcessInstantiationBuilder>- Parameters:
transitionId- the sequence flow to execute
-
setVariable
public ProcessInstantiationBuilder setVariable(java.lang.String name, java.lang.Object value)
Description copied from interface:ActivityInstantiationBuilderIf an instruction is submitted before then the variable is set when the instruction is executed. Otherwise, the variable is set on the process instance itself.- Specified by:
setVariablein interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariableLocal
public ProcessInstantiationBuilder setVariableLocal(java.lang.String name, java.lang.Object value)
Description copied from interface:ActivityInstantiationBuilderIf an instruction is submitted before then the local variable is set when the instruction is executed. Otherwise, the variable is set on the process instance itself.- Specified by:
setVariableLocalin interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariables
public ProcessInstantiationBuilder setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface:ActivityInstantiationBuilderIf an instruction is submitted before then all variables are set when the instruction is executed. Otherwise, the variables are set on the process instance itself.- Specified by:
setVariablesin interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariablesLocal
public ProcessInstantiationBuilder setVariablesLocal(java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface:ActivityInstantiationBuilderIf an instruction is submitted before then all local variables are set when the instruction is executed. Otherwise, the variables are set on the process instance itself.- Specified by:
setVariablesLocalin interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
businessKey
public ProcessInstantiationBuilder businessKey(java.lang.String businessKey)
Description copied from interface:ProcessInstantiationBuilderSet the business key for the process instance- Specified by:
businessKeyin interfaceProcessInstantiationBuilder
-
caseInstanceId
public ProcessInstantiationBuilder caseInstanceId(java.lang.String caseInstanceId)
Description copied from interface:ProcessInstantiationBuilderAssociate a case instance with the process instance- Specified by:
caseInstanceIdin interfaceProcessInstantiationBuilder
-
tenantId
public ProcessInstantiationBuilder tenantId(java.lang.String tenantId)
-
processDefinitionTenantId
public ProcessInstantiationBuilder processDefinitionTenantId(java.lang.String tenantId)
Description copied from interface:ProcessInstantiationBuilderSpecify the id of the tenant the process definition belongs to. Can only be used when the definition is referenced bykeyand not byid.- Specified by:
processDefinitionTenantIdin interfaceProcessInstantiationBuilder
-
processDefinitionWithoutTenantId
public ProcessInstantiationBuilder processDefinitionWithoutTenantId()
Description copied from interface:ProcessInstantiationBuilderSpecify that the process definition belongs to no tenant. Can only be used when the definition is referenced bykeyand not byid.- Specified by:
processDefinitionWithoutTenantIdin interfaceProcessInstantiationBuilder
-
execute
public ProcessInstance execute()
Description copied from interface:ProcessInstantiationBuilderStart the process instance.- Specified by:
executein interfaceProcessInstantiationBuilder- Returns:
- the newly created process instance
- See Also:
.
-
execute
public ProcessInstance execute(boolean skipCustomListeners, boolean skipIoMappings)
Description copied from interface:ProcessInstantiationBuilderStart the process instance.- Specified by:
executein interfaceProcessInstantiationBuilder- Parameters:
skipCustomListeners- specifies whether custom listeners (task and execution) should be invoked when executing the instructions. Only supported for instructions.skipIoMappings- specifies whether input/output mappings for tasks should be invoked throughout the transaction when executing the instructions. Only supported for instructions.- Returns:
- the newly created process instance
- See Also:
.
-
executeWithVariablesInReturn
public ProcessInstanceWithVariables executeWithVariablesInReturn()
Description copied from interface:ProcessInstantiationBuilderStart the process instance. If no instantiation instructions are set then the instance start at the default start activity. Otherwise, all instructions are executed in the order they are submitted. Custom execution and task listeners, as well as task input output mappings are triggered.- Specified by:
executeWithVariablesInReturnin interfaceProcessInstantiationBuilder- Returns:
- the newly created process instance with the latest variables
-
executeWithVariablesInReturn
public ProcessInstanceWithVariables executeWithVariablesInReturn(boolean skipCustomListeners, boolean skipIoMappings)
Description copied from interface:ProcessInstantiationBuilderStart the process instance. If no instantiation instructions are set then the instance start at the default start activity. Otherwise, all instructions are executed in the order they are submitted.- Specified by:
executeWithVariablesInReturnin interfaceProcessInstantiationBuilder- Parameters:
skipCustomListeners- specifies whether custom listeners (task and execution) should be invoked when executing the instructions. Only supported for instructions.skipIoMappings- specifies whether input/output mappings for tasks should be invoked throughout the transaction when executing the instructions. Only supported for instructions.- Returns:
- the newly created process instance with the latest variables
-
getProcessDefinitionId
public java.lang.String getProcessDefinitionId()
-
getProcessDefinitionKey
public java.lang.String getProcessDefinitionKey()
-
getModificationBuilder
public ProcessInstanceModificationBuilderImpl getModificationBuilder()
-
getBusinessKey
public java.lang.String getBusinessKey()
-
getCaseInstanceId
public java.lang.String getCaseInstanceId()
-
getVariables
public java.util.Map<java.lang.String,java.lang.Object> getVariables()
-
getTenantId
public java.lang.String getTenantId()
-
getProcessDefinitionTenantId
public java.lang.String getProcessDefinitionTenantId()
-
isProcessDefinitionTenantIdSet
public boolean isProcessDefinitionTenantIdSet()
-
setModificationBuilder
public void setModificationBuilder(ProcessInstanceModificationBuilderImpl modificationBuilder)
-
createProcessInstanceById
public static ProcessInstantiationBuilder createProcessInstanceById(CommandExecutor commandExecutor, java.lang.String processDefinitionId)
-
createProcessInstanceByKey
public static ProcessInstantiationBuilder createProcessInstanceByKey(CommandExecutor commandExecutor, java.lang.String processDefinitionKey)
-
-