org.camunda.bpm.engine.impl
Class ProcessInstantiationBuilderImpl

java.lang.Object
  extended by 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
protected  String businessKey
           
protected  String caseInstanceId
           
protected  CommandExecutor commandExecutor
           
protected  boolean isTenantIdSet
           
protected  ProcessInstanceModificationBuilderImpl modificationBuilder
           
protected  String processDefinitionId
           
protected  String processDefinitionKey
           
protected  String processDefinitionTenantId
           
 
Method Summary
 ProcessInstantiationBuilder businessKey(String businessKey)
          Set the business key for the process instance
 ProcessInstantiationBuilder caseInstanceId(String caseInstanceId)
          Associate a case instance with the process instance
static 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()
           
 Map<String,Object> getVariables()
           
 boolean isTenantIdSet()
           
 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.
 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 like InstantiationBuilder.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:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandExecutor

protected CommandExecutor commandExecutor

processDefinitionId

protected String processDefinitionId

processDefinitionKey

protected String processDefinitionKey

businessKey

protected String businessKey

caseInstanceId

protected String caseInstanceId

processDefinitionTenantId

protected String processDefinitionTenantId

isTenantIdSet

protected boolean isTenantIdSet

modificationBuilder

protected ProcessInstanceModificationBuilderImpl modificationBuilder
Method Detail

startBeforeActivity

public ProcessInstantiationBuilder startBeforeActivity(String activityId)
Description copied from interface: InstantiationBuilder

Submits the instruction:

Start before the specified activity.

In particular:

Specified by:
startBeforeActivity in interface InstantiationBuilder<ProcessInstantiationBuilder>
Parameters:
activityId - the activity to instantiate

startAfterActivity

public ProcessInstantiationBuilder startAfterActivity(String activityId)
Description copied from interface: InstantiationBuilder
Submits an instruction that behaves like InstantiationBuilder.startTransition(String) and always instantiates the single outgoing sequence flow of the given activity. Does not consider asyncAfter.

Specified by:
startAfterActivity in interface InstantiationBuilder<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:

Specified by:
startTransition in interface InstantiationBuilder<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 interface ActivityInstantiationBuilder<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 interface ActivityInstantiationBuilder<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 interface ActivityInstantiationBuilder<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 interface ActivityInstantiationBuilder<ProcessInstantiationBuilder>

businessKey

public ProcessInstantiationBuilder businessKey(String businessKey)
Description copied from interface: ProcessInstantiationBuilder
Set the business key for the process instance

Specified by:
businessKey in interface ProcessInstantiationBuilder

caseInstanceId

public ProcessInstantiationBuilder caseInstanceId(String caseInstanceId)
Description copied from interface: ProcessInstantiationBuilder
Associate a case instance with the process instance

Specified by:
caseInstanceId in interface ProcessInstantiationBuilder

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 by key and not by id.

Specified by:
processDefinitionTenantId in interface ProcessInstantiationBuilder

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 by key and not by id.

Specified by:
processDefinitionWithoutTenantId in interface ProcessInstantiationBuilder

execute

public ProcessInstance execute()
Description copied from interface: ProcessInstantiationBuilder
Start the process instance.

Specified by:
execute in interface ProcessInstantiationBuilder
Returns:
the newly created process instance

execute

public ProcessInstance execute(boolean skipCustomListeners,
                               boolean skipIoMappings)
Description copied from interface: ProcessInstantiationBuilder
Start the process instance.

Specified by:
execute in interface ProcessInstantiationBuilder
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

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 interface ProcessInstantiationBuilder
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 interface ProcessInstantiationBuilder
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()

getVariables

public Map<String,Object> getVariables()

getProcessDefinitionTenantId

public String getProcessDefinitionTenantId()

isTenantIdSet

public boolean isTenantIdSet()

createProcessInstanceById

public static ProcessInstantiationBuilder createProcessInstanceById(CommandExecutor commandExecutor,
                                                                    String processDefinitionId)

createProcessInstanceByKey

public static ProcessInstantiationBuilder createProcessInstanceByKey(CommandExecutor commandExecutor,
                                                                     String processDefinitionKey)


Copyright © 2016 camunda services GmbH. All rights reserved.