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 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 String
businessKey
protected String
caseInstanceId
protected CommandExecutor
commandExecutor
protected boolean
isProcessDefinitionTenantIdSet
protected ProcessInstanceModificationBuilderImpl
modificationBuilder
protected String
processDefinitionId
protected String
processDefinitionKey
protected String
processDefinitionTenantId
protected 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(String businessKey)
Set the business key for the process instanceProcessInstantiationBuilder
caseInstanceId(String caseInstanceId)
Associate a case instance with the process instancestatic ProcessInstantiationBuilder
createProcessInstanceById(CommandExecutor commandExecutor, String processDefinitionId)
static ProcessInstantiationBuilder
createProcessInstanceByKey(CommandExecutor commandExecutor, 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.String
getBusinessKey()
String
getCaseInstanceId()
ProcessInstanceModificationBuilderImpl
getModificationBuilder()
String
getProcessDefinitionId()
String
getProcessDefinitionKey()
String
getProcessDefinitionTenantId()
String
getTenantId()
Map<String,Object>
getVariables()
boolean
isProcessDefinitionTenantIdSet()
ProcessInstantiationBuilder
processDefinitionTenantId(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(String name, Object value)
If an instruction is submitted before then the variable is set when the instruction is executed.ProcessInstantiationBuilder
setVariableLocal(String name, Object value)
If an instruction is submitted before then the local variable is set when the instruction is executed.ProcessInstantiationBuilder
setVariables(Map<String,Object> variables)
If an instruction is submitted before then all variables are set when the instruction is executed.ProcessInstantiationBuilder
setVariablesLocal(Map<String,Object> variables)
If an instruction is submitted before then all local variables are set when the instruction is executed.ProcessInstantiationBuilder
startAfterActivity(String activityId)
Submits an instruction that behaves likeInstantiationBuilder.startTransition(String)
and always instantiates the single outgoing sequence flow of the given activity.ProcessInstantiationBuilder
startBeforeActivity(String activityId)
Submits the instruction:ProcessInstantiationBuilder
startTransition(String transitionId)
Submits the instruction:ProcessInstantiationBuilder
tenantId(String tenantId)
-
-
-
Field Detail
-
commandExecutor
protected CommandExecutor commandExecutor
-
processDefinitionId
protected String processDefinitionId
-
processDefinitionKey
protected String processDefinitionKey
-
businessKey
protected String businessKey
-
caseInstanceId
protected String caseInstanceId
-
tenantId
protected String tenantId
-
processDefinitionTenantId
protected String processDefinitionTenantId
-
isProcessDefinitionTenantIdSet
protected boolean isProcessDefinitionTenantIdSet
-
modificationBuilder
protected ProcessInstanceModificationBuilderImpl modificationBuilder
-
-
Constructor Detail
-
ProcessInstantiationBuilderImpl
protected ProcessInstantiationBuilderImpl(CommandExecutor commandExecutor)
-
-
Method Detail
-
startBeforeActivity
public ProcessInstantiationBuilder startBeforeActivity(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(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(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(String name, 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(String name, 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(Map<String,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(Map<String,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(String businessKey)
Description copied from interface:ProcessInstantiationBuilder
Set the business key for the process instance- Specified by:
businessKey
in interfaceProcessInstantiationBuilder
-
caseInstanceId
public ProcessInstantiationBuilder caseInstanceId(String caseInstanceId)
Description copied from interface:ProcessInstantiationBuilder
Associate a case instance with the process instance- Specified by:
caseInstanceId
in interfaceProcessInstantiationBuilder
-
tenantId
public ProcessInstantiationBuilder tenantId(String tenantId)
-
processDefinitionTenantId
public ProcessInstantiationBuilder processDefinitionTenantId(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 String getProcessDefinitionId()
-
getProcessDefinitionKey
public String getProcessDefinitionKey()
-
getModificationBuilder
public ProcessInstanceModificationBuilderImpl getModificationBuilder()
-
getBusinessKey
public String getBusinessKey()
-
getCaseInstanceId
public String getCaseInstanceId()
-
getTenantId
public String getTenantId()
-
getProcessDefinitionTenantId
public String getProcessDefinitionTenantId()
-
isProcessDefinitionTenantIdSet
public boolean isProcessDefinitionTenantIdSet()
-
setModificationBuilder
public void setModificationBuilder(ProcessInstanceModificationBuilderImpl modificationBuilder)
-
createProcessInstanceById
public static ProcessInstantiationBuilder createProcessInstanceById(CommandExecutor commandExecutor, String processDefinitionId)
-
createProcessInstanceByKey
public static ProcessInstantiationBuilder createProcessInstanceByKey(CommandExecutor commandExecutor, String processDefinitionKey)
-
-