Class ProcessInstanceModificationBuilderImpl
- java.lang.Object
-
- org.camunda.bpm.engine.impl.ProcessInstanceModificationBuilderImpl
-
- All Implemented Interfaces:
ActivityInstantiationBuilder<ProcessInstanceModificationInstantiationBuilder>
,InstantiationBuilder<ProcessInstanceModificationInstantiationBuilder>
,ProcessInstanceModificationBuilder
,ProcessInstanceModificationInstantiationBuilder
public class ProcessInstanceModificationBuilderImpl extends java.lang.Object implements ProcessInstanceModificationInstantiationBuilder
- Author:
- Thorben Lindhauer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
annotation
protected CommandContext
commandContext
protected CommandExecutor
commandExecutor
protected boolean
externallyTerminated
protected java.lang.String
modificationReason
protected java.util.List<AbstractProcessInstanceModificationCommand>
operations
protected java.lang.String
processInstanceId
protected VariableMap
processVariables
protected boolean
skipCustomListeners
protected boolean
skipIoMappings
-
Constructor Summary
Constructors Constructor Description ProcessInstanceModificationBuilderImpl()
ProcessInstanceModificationBuilderImpl(java.lang.String processInstanceId)
ProcessInstanceModificationBuilderImpl(CommandContext commandContext, java.lang.String processInstanceId)
ProcessInstanceModificationBuilderImpl(CommandContext commandContext, java.lang.String processInstanceId, java.lang.String modificationReason)
ProcessInstanceModificationBuilderImpl(CommandExecutor commandExecutor, java.lang.String processInstanceId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessInstanceModificationBuilder
cancelActivityInstance(java.lang.String activityInstanceId)
Submits the instruction:ProcessInstanceModificationBuilder
cancelAllForActivity(java.lang.String activityId)
Submits the instruction:ProcessInstanceModificationBuilder
cancellationSourceExternal(boolean external)
A canceled process instance receives a termination state to indicate the source of the cancellation call.ProcessInstanceModificationBuilder
cancelTransitionInstance(java.lang.String transitionInstanceId)
Submits the instruction:void
execute()
Execute all instructions.void
execute(boolean skipCustomListeners, boolean skipIoMappings)
void
execute(boolean writeUserOperationLog, boolean skipCustomListeners, boolean skipIoMappings)
Batch
executeAsync()
Execute all instructions asynchronously.Batch
executeAsync(boolean skipCustomListeners, boolean skipIoMappings)
java.lang.String
getAnnotation()
CommandContext
getCommandContext()
CommandExecutor
getCommandExecutor()
protected AbstractInstantiationCmd
getCurrentInstantiation()
java.util.List<AbstractProcessInstanceModificationCommand>
getModificationOperations()
java.lang.String
getModificationReason()
java.lang.String
getProcessInstanceId()
VariableMap
getProcessVariables()
boolean
isExternallyTerminated()
boolean
isSkipCustomListeners()
boolean
isSkipIoMappings()
ProcessInstanceModificationBuilder
setAnnotation(java.lang.String annotation)
Provides annotation for the current modification.void
setAnnotationInternal(java.lang.String annotation)
void
setModificationOperations(java.util.List<AbstractProcessInstanceModificationCommand> operations)
void
setModificationReason(java.lang.String modificationReason)
void
setSkipCustomListeners(boolean skipCustomListeners)
void
setSkipIoMappings(boolean skipIoMappings)
ProcessInstanceModificationInstantiationBuilder
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.ProcessInstanceModificationInstantiationBuilder
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.ProcessInstanceModificationInstantiationBuilder
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.ProcessInstanceModificationInstantiationBuilder
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.ProcessInstanceModificationInstantiationBuilder
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.ProcessInstanceModificationInstantiationBuilder
startAfterActivity(java.lang.String activityId, java.lang.String ancestorActivityInstanceId)
Submits an instruction that behaves likeProcessInstanceModificationBuilder.startTransition(String,String)
and always instantiates the single outgoing sequence flow of the given activity.ProcessInstanceModificationInstantiationBuilder
startBeforeActivity(java.lang.String activityId)
Submits the instruction:ProcessInstanceModificationInstantiationBuilder
startBeforeActivity(java.lang.String activityId, java.lang.String ancestorActivityInstanceId)
Submits the instruction:ProcessInstanceModificationInstantiationBuilder
startTransition(java.lang.String transitionId)
Submits the instruction:ProcessInstanceModificationInstantiationBuilder
startTransition(java.lang.String transitionId, java.lang.String ancestorActivityInstanceId)
Submits the instruction:
-
-
-
Field Detail
-
commandExecutor
protected CommandExecutor commandExecutor
-
commandContext
protected CommandContext commandContext
-
processInstanceId
protected java.lang.String processInstanceId
-
modificationReason
protected java.lang.String modificationReason
-
skipCustomListeners
protected boolean skipCustomListeners
-
skipIoMappings
protected boolean skipIoMappings
-
externallyTerminated
protected boolean externallyTerminated
-
annotation
protected java.lang.String annotation
-
operations
protected java.util.List<AbstractProcessInstanceModificationCommand> operations
-
processVariables
protected VariableMap processVariables
-
-
Constructor Detail
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandExecutor commandExecutor, java.lang.String processInstanceId)
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandContext commandContext, java.lang.String processInstanceId)
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandContext commandContext, java.lang.String processInstanceId, java.lang.String modificationReason)
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(java.lang.String processInstanceId)
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl()
-
-
Method Detail
-
cancelActivityInstance
public ProcessInstanceModificationBuilder cancelActivityInstance(java.lang.String activityInstanceId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits the instruction:
Cancel an activity instance in a process. If this instance has child activity instances (e.g. in a subprocess instance), these children, their grandchildren, etc. are cancelled as well.
Process instance cancellation will propagate upward, removing any parent process instances that are only waiting on the cancelled process to complete.
- Specified by:
cancelActivityInstance
in interfaceProcessInstanceModificationBuilder
- Parameters:
activityInstanceId
- the id of the activity instance to cancel
-
cancelTransitionInstance
public ProcessInstanceModificationBuilder cancelTransitionInstance(java.lang.String transitionInstanceId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits the instruction:
Cancel a transition instance (i.e. an async continuation) in a process.
- Specified by:
cancelTransitionInstance
in interfaceProcessInstanceModificationBuilder
- Parameters:
transitionInstanceId
- the id of the transition instance to cancel
-
cancelAllForActivity
public ProcessInstanceModificationBuilder cancelAllForActivity(java.lang.String activityId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits the instruction:
Cancel all instances of the given activity in an arbitrary order, which are:
- activity instances of that activity
- transition instances entering or leaving that activity
Therefore behaves like
ProcessInstanceModificationBuilder.cancelActivityInstance(String)
for each individual activity instance and likeProcessInstanceModificationBuilder.cancelTransitionInstance(String)
for each individual transition instance.The cancellation order of the instances is arbitrary
- Specified by:
cancelAllForActivity
in interfaceProcessInstanceModificationBuilder
- Parameters:
activityId
- the activity for which all instances should be cancelled
-
cancellationSourceExternal
public ProcessInstanceModificationBuilder cancellationSourceExternal(boolean external)
Description copied from interface:ProcessInstanceModificationBuilder
A canceled process instance receives a termination state to indicate the source of the cancellation call. The state can have the following values:
EXTERNALLY_TERMINATED
: the cancellation was triggered by an external source. (e.g. REST call, external application)INTERNALLY_TERMINATED
: the cancellation was triggered internally. (e.g. by the engine)
- Specified by:
cancellationSourceExternal
in interfaceProcessInstanceModificationBuilder
- Parameters:
external
- was the cancellation triggered by an external source?true
forEXTERNALLY_TERMINATED
,false
forINTERNALLY_TERMINATED
.
-
startBeforeActivity
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
- Parameters:
activityId
- the activity to instantiate
-
startBeforeActivity
public ProcessInstanceModificationInstantiationBuilder startBeforeActivity(java.lang.String activityId, java.lang.String ancestorActivityInstanceId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits the instruction:
Start before the specified activity. Instantiate the given activity as a descendant of the given ancestor activity instance.
In particular:
- Instantiate all activities between the ancestor activity and the activity to execute
- Instantiate and execute the given activity (respects the asyncBefore attribute of the activity)
- Specified by:
startBeforeActivity
in interfaceProcessInstanceModificationBuilder
- Parameters:
activityId
- the activity to instantiateancestorActivityInstanceId
- the ID of an existing activity instance under which the new activity instance should be created
-
startAfterActivity
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
- Parameters:
activityId
- the activity for which the outgoing flow should be executed
-
startAfterActivity
public ProcessInstanceModificationInstantiationBuilder startAfterActivity(java.lang.String activityId, java.lang.String ancestorActivityInstanceId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits an instruction that behaves likeProcessInstanceModificationBuilder.startTransition(String,String)
and always instantiates the single outgoing sequence flow of the given activity. Does not consider asyncAfter.- Specified by:
startAfterActivity
in interfaceProcessInstanceModificationBuilder
- Parameters:
activityId
- the activity for which the outgoing flow should be executed
-
startTransition
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
- Parameters:
transitionId
- the sequence flow to execute
-
startTransition
public ProcessInstanceModificationInstantiationBuilder startTransition(java.lang.String transitionId, java.lang.String ancestorActivityInstanceId)
Description copied from interface:ProcessInstanceModificationBuilder
Submits the instruction:
Start the specified sequence flow. Instantiate the given sequence flow as a descendant of the given ancestor activity instance.
In particular:
- Instantiate all activities between the ancestor activity and the activity to execute
- Execute the given transition (does not consider sequence flow conditions)
- Specified by:
startTransition
in interfaceProcessInstanceModificationBuilder
- Parameters:
transitionId
- the sequence flow to executeancestorActivityInstanceId
- the ID of an existing activity instance under which the new transition should be executed
-
getCurrentInstantiation
protected AbstractInstantiationCmd getCurrentInstantiation()
-
setVariable
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
-
setVariableLocal
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
-
setVariables
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
-
setVariablesLocal
public ProcessInstanceModificationInstantiationBuilder 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<ProcessInstanceModificationInstantiationBuilder>
-
setAnnotation
public ProcessInstanceModificationBuilder setAnnotation(java.lang.String annotation)
Description copied from interface:ProcessInstanceModificationBuilder
Provides annotation for the current modification.- Specified by:
setAnnotation
in interfaceProcessInstanceModificationBuilder
-
execute
public void execute()
Description copied from interface:ProcessInstanceModificationBuilder
Execute all instructions. Custom execution and task listeners, as well as task input output mappings are executed.- Specified by:
execute
in interfaceProcessInstanceModificationBuilder
-
execute
public void execute(boolean skipCustomListeners, boolean skipIoMappings)
- Specified by:
execute
in interfaceProcessInstanceModificationBuilder
- Parameters:
skipCustomListeners
- specifies whether custom listeners (task and execution) should be invoked when executing the instructionsskipIoMappings
- specifies whether input/output mappings for tasks should be invoked throughout the transaction when executing the instructions
-
execute
public void execute(boolean writeUserOperationLog, boolean skipCustomListeners, boolean skipIoMappings)
-
executeAsync
public Batch executeAsync()
Description copied from interface:ProcessInstanceModificationBuilder
Execute all instructions asynchronously. Custom execution and task listeners, as well as task input output mappings are executed.- Specified by:
executeAsync
in interfaceProcessInstanceModificationBuilder
- Returns:
- a batch job to be executed by the executor
-
executeAsync
public Batch executeAsync(boolean skipCustomListeners, boolean skipIoMappings)
- Specified by:
executeAsync
in interfaceProcessInstanceModificationBuilder
- Parameters:
skipCustomListeners
- specifies whether custom listeners (task and execution) should be invoked when executing the instructionsskipIoMappings
- specifies whether input/output mappings for tasks should be invoked throughout the transaction when executing the instructions- Returns:
- a batch job to be executed by the executor
-
getCommandExecutor
public CommandExecutor getCommandExecutor()
-
getCommandContext
public CommandContext getCommandContext()
-
getProcessInstanceId
public java.lang.String getProcessInstanceId()
-
getModificationOperations
public java.util.List<AbstractProcessInstanceModificationCommand> getModificationOperations()
-
setModificationOperations
public void setModificationOperations(java.util.List<AbstractProcessInstanceModificationCommand> operations)
-
isSkipCustomListeners
public boolean isSkipCustomListeners()
-
isSkipIoMappings
public boolean isSkipIoMappings()
-
isExternallyTerminated
public boolean isExternallyTerminated()
-
setSkipCustomListeners
public void setSkipCustomListeners(boolean skipCustomListeners)
-
setSkipIoMappings
public void setSkipIoMappings(boolean skipIoMappings)
-
getProcessVariables
public VariableMap getProcessVariables()
-
getModificationReason
public java.lang.String getModificationReason()
-
setModificationReason
public void setModificationReason(java.lang.String modificationReason)
-
getAnnotation
public java.lang.String getAnnotation()
-
setAnnotationInternal
public void setAnnotationInternal(java.lang.String annotation)
-
-