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.String
businessKey
protected java.lang.String
caseInstanceId
protected CommandExecutor
commandExecutor
protected boolean
isProcessDefinitionTenantIdSet
protected ProcessInstanceModificationBuilderImpl
modificationBuilder
protected java.lang.String
processDefinitionId
protected java.lang.String
processDefinitionKey
protected java.lang.String
processDefinitionTenantId
protected java.lang.String
tenantId
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProcessInstantiationBuilderImpl(CommandExecutor commandExecutor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessInstantiationBuilder
businessKey(java.lang.String businessKey)
Set the business key for the process instanceProcessInstantiationBuilder
caseInstanceId(java.lang.String caseInstanceId)
Associate a case instance with the process instancestatic ProcessInstantiationBuilder
createProcessInstanceById(CommandExecutor commandExecutor, java.lang.String processDefinitionId)
static ProcessInstantiationBuilder
createProcessInstanceByKey(CommandExecutor commandExecutor, java.lang.String processDefinitionKey)
ProcessInstance
execute()
Start the process instance.ProcessInstance
execute(boolean skipCustomListeners, boolean skipIoMappings)
Start the process instance.ProcessInstanceWithVariables
executeWithVariablesInReturn()
Start the process instance.ProcessInstanceWithVariables
executeWithVariablesInReturn(boolean skipCustomListeners, boolean skipIoMappings)
Start the process instance.java.lang.String
getBusinessKey()
java.lang.String
getCaseInstanceId()
ProcessInstanceModificationBuilderImpl
getModificationBuilder()
java.lang.String
getProcessDefinitionId()
java.lang.String
getProcessDefinitionKey()
java.lang.String
getProcessDefinitionTenantId()
java.lang.String
getTenantId()
java.util.Map<java.lang.String,java.lang.Object>
getVariables()
boolean
isProcessDefinitionTenantIdSet()
ProcessInstantiationBuilder
processDefinitionTenantId(java.lang.String tenantId)
Specify the id of the tenant the process definition belongs to.ProcessInstantiationBuilder
processDefinitionWithoutTenantId()
Specify that the process definition belongs to no tenant.void
setModificationBuilder(ProcessInstanceModificationBuilderImpl modificationBuilder)
ProcessInstantiationBuilder
setVariable(java.lang.String name, java.lang.Object value)
If an instruction is submitted before then the variable is set when the instruction is executed.ProcessInstantiationBuilder
setVariableLocal(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.ProcessInstantiationBuilder
setVariables(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.ProcessInstantiationBuilder
setVariablesLocal(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.ProcessInstantiationBuilder
startAfterActivity(java.lang.String activityId)
Submits an instruction that behaves likeInstantiationBuilder.startTransition(String)
and always instantiates the single outgoing sequence flow of the given activity.ProcessInstantiationBuilder
startBeforeActivity(java.lang.String activityId)
Submits the instruction:ProcessInstantiationBuilder
startTransition(java.lang.String transitionId)
Submits the instruction:ProcessInstantiationBuilder
tenantId(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:InstantiationBuilder
Submits 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:
startBeforeActivity
in interfaceInstantiationBuilder<ProcessInstantiationBuilder>
- Parameters:
activityId
- the activity to instantiate
-
startAfterActivity
public ProcessInstantiationBuilder startAfterActivity(java.lang.String activityId)
Description copied from interface:InstantiationBuilder
Submits 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:
startAfterActivity
in 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:InstantiationBuilder
Submits 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:
startTransition
in 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:ActivityInstantiationBuilder
If 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:
setVariable
in interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariableLocal
public ProcessInstantiationBuilder setVariableLocal(java.lang.String name, java.lang.Object value)
Description copied from interface:ActivityInstantiationBuilder
If 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:
setVariableLocal
in interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariables
public ProcessInstantiationBuilder setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface:ActivityInstantiationBuilder
If 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:
setVariables
in interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
setVariablesLocal
public ProcessInstantiationBuilder setVariablesLocal(java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface:ActivityInstantiationBuilder
If 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:
setVariablesLocal
in interfaceActivityInstantiationBuilder<ProcessInstantiationBuilder>
-
businessKey
public ProcessInstantiationBuilder businessKey(java.lang.String businessKey)
Description copied from interface:ProcessInstantiationBuilder
Set the business key for the process instance- Specified by:
businessKey
in interfaceProcessInstantiationBuilder
-
caseInstanceId
public ProcessInstantiationBuilder caseInstanceId(java.lang.String caseInstanceId)
Description copied from interface:ProcessInstantiationBuilder
Associate a case instance with the process instance- Specified by:
caseInstanceId
in interfaceProcessInstantiationBuilder
-
tenantId
public ProcessInstantiationBuilder tenantId(java.lang.String tenantId)
-
processDefinitionTenantId
public ProcessInstantiationBuilder processDefinitionTenantId(java.lang.String tenantId)
Description copied from interface:ProcessInstantiationBuilder
Specify the id of the tenant the process definition belongs to. Can only be used when the definition is referenced bykey
and not byid
.- Specified by:
processDefinitionTenantId
in interfaceProcessInstantiationBuilder
-
processDefinitionWithoutTenantId
public ProcessInstantiationBuilder processDefinitionWithoutTenantId()
Description copied from interface:ProcessInstantiationBuilder
Specify that the process definition belongs to no tenant. Can only be used when the definition is referenced bykey
and not byid
.- Specified by:
processDefinitionWithoutTenantId
in interfaceProcessInstantiationBuilder
-
execute
public ProcessInstance execute()
Description copied from interface:ProcessInstantiationBuilder
Start the process instance.- Specified by:
execute
in interfaceProcessInstantiationBuilder
- Returns:
- the newly created process instance
- See Also:
.
-
execute
public ProcessInstance execute(boolean skipCustomListeners, boolean skipIoMappings)
Description copied from interface:ProcessInstantiationBuilder
Start the process instance.- Specified by:
execute
in 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:ProcessInstantiationBuilder
Start 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:
executeWithVariablesInReturn
in interfaceProcessInstantiationBuilder
- Returns:
- the newly created process instance with the latest variables
-
executeWithVariablesInReturn
public ProcessInstanceWithVariables executeWithVariablesInReturn(boolean skipCustomListeners, boolean skipIoMappings)
Description copied from interface:ProcessInstantiationBuilder
Start 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:
executeWithVariablesInReturn
in 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)
-
-