Class ProcessInstanceModificationBuilderImpl
- All Implemented Interfaces:
ActivityInstantiationBuilder<ProcessInstanceModificationInstantiationBuilder>,InstantiationBuilder<ProcessInstanceModificationInstantiationBuilder>,ProcessInstanceModificationBuilder,ProcessInstanceModificationInstantiationBuilder
- Author:
- Thorben Lindhauer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected CommandContextprotected CommandExecutorprotected booleanprotected Stringprotected List<AbstractProcessInstanceModificationCommand>protected Stringprotected VariableMapprotected booleanprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionProcessInstanceModificationBuilderImpl(String processInstanceId) ProcessInstanceModificationBuilderImpl(CommandContext commandContext, String processInstanceId) ProcessInstanceModificationBuilderImpl(CommandContext commandContext, String processInstanceId, String modificationReason) ProcessInstanceModificationBuilderImpl(CommandExecutor commandExecutor, String processInstanceId) -
Method Summary
Modifier and TypeMethodDescriptioncancelActivityInstance(String activityInstanceId) Submits the instruction:cancelAllForActivity(String activityId) Submits the instruction:cancellationSourceExternal(boolean external) A canceled process instance receives a termination state to indicate the source of the cancellation call.cancelTransitionInstance(String transitionInstanceId) Submits the instruction:voidexecute()Execute all instructions.voidexecute(boolean skipCustomListeners, boolean skipIoMappings) voidexecute(boolean writeUserOperationLog, boolean skipCustomListeners, boolean skipIoMappings) Execute all instructions asynchronously.executeAsync(boolean skipCustomListeners, boolean skipIoMappings) protected AbstractInstantiationCmdbooleanbooleanbooleansetAnnotation(String annotation) Provides annotation for the current modification.voidsetAnnotationInternal(String annotation) voidvoidsetModificationReason(String modificationReason) voidsetSkipCustomListeners(boolean skipCustomListeners) voidsetSkipIoMappings(boolean skipIoMappings) setVariable(String name, Object value) If an instruction is submitted before then the variable is set when the instruction is executed.setVariableLocal(String name, Object value) If an instruction is submitted before then the local variable is set when the instruction is executed.setVariables(Map<String, Object> variables) If an instruction is submitted before then all variables are set when the instruction is executed.setVariablesLocal(Map<String, Object> variables) If an instruction is submitted before then all local variables are set when the instruction is executed.startAfterActivity(String activityId) Submits an instruction that behaves likeInstantiationBuilder.startTransition(String)and always instantiates the single outgoing sequence flow of the given activity.startAfterActivity(String activityId, String ancestorActivityInstanceId) Submits an instruction that behaves likeProcessInstanceModificationBuilder.startTransition(String,String)and always instantiates the single outgoing sequence flow of the given activity.startBeforeActivity(String activityId) Submits the instruction:startBeforeActivity(String activityId, String ancestorActivityInstanceId) Submits the instruction:startTransition(String transitionId) Submits the instruction:startTransition(String transitionId, String ancestorActivityInstanceId) Submits the instruction:
-
Field Details
-
commandExecutor
-
commandContext
-
processInstanceId
-
modificationReason
-
skipCustomListeners
protected boolean skipCustomListeners -
skipIoMappings
protected boolean skipIoMappings -
externallyTerminated
protected boolean externallyTerminated -
annotation
-
operations
-
processVariables
-
-
Constructor Details
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandExecutor commandExecutor, String processInstanceId) -
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandContext commandContext, String processInstanceId) -
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl(CommandContext commandContext, String processInstanceId, String modificationReason) -
ProcessInstanceModificationBuilderImpl
-
ProcessInstanceModificationBuilderImpl
public ProcessInstanceModificationBuilderImpl()
-
-
Method Details
-
cancelActivityInstance
Description copied from interface:ProcessInstanceModificationBuilderSubmits 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:
cancelActivityInstancein interfaceProcessInstanceModificationBuilder- Parameters:
activityInstanceId- the id of the activity instance to cancel
-
cancelTransitionInstance
Description copied from interface:ProcessInstanceModificationBuilderSubmits the instruction:
Cancel a transition instance (i.e. an async continuation) in a process.
- Specified by:
cancelTransitionInstancein interfaceProcessInstanceModificationBuilder- Parameters:
transitionInstanceId- the id of the transition instance to cancel
-
cancelAllForActivity
Description copied from interface:ProcessInstanceModificationBuilderSubmits 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:
cancelAllForActivityin interfaceProcessInstanceModificationBuilder- Parameters:
activityId- the activity for which all instances should be cancelled
-
cancellationSourceExternal
Description copied from interface:ProcessInstanceModificationBuilderA 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:
cancellationSourceExternalin interfaceProcessInstanceModificationBuilder- Parameters:
external- was the cancellation triggered by an external source?trueforEXTERNALLY_TERMINATED,falseforINTERNALLY_TERMINATED.
-
startBeforeActivity
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<ProcessInstanceModificationInstantiationBuilder>- Parameters:
activityId- the activity to instantiate
-
startBeforeActivity
public ProcessInstanceModificationInstantiationBuilder startBeforeActivity(String activityId, String ancestorActivityInstanceId) Description copied from interface:ProcessInstanceModificationBuilderSubmits 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:
startBeforeActivityin interfaceProcessInstanceModificationBuilder- Parameters:
activityId- the activity to instantiateancestorActivityInstanceId- the ID of an existing activity instance under which the new activity instance should be created
-
startAfterActivity
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<ProcessInstanceModificationInstantiationBuilder>- Parameters:
activityId- the activity for which the outgoing flow should be executed
-
startAfterActivity
public ProcessInstanceModificationInstantiationBuilder startAfterActivity(String activityId, String ancestorActivityInstanceId) Description copied from interface:ProcessInstanceModificationBuilderSubmits 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:
startAfterActivityin interfaceProcessInstanceModificationBuilder- Parameters:
activityId- the activity for which the outgoing flow should be executed
-
startTransition
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<ProcessInstanceModificationInstantiationBuilder>- Parameters:
transitionId- the sequence flow to execute
-
startTransition
public ProcessInstanceModificationInstantiationBuilder startTransition(String transitionId, String ancestorActivityInstanceId) Description copied from interface:ProcessInstanceModificationBuilderSubmits 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:
startTransitionin interfaceProcessInstanceModificationBuilder- Parameters:
transitionId- the sequence flow to executeancestorActivityInstanceId- the ID of an existing activity instance under which the new transition should be executed
-
getCurrentInstantiation
-
setVariable
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<ProcessInstanceModificationInstantiationBuilder>
-
setVariableLocal
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<ProcessInstanceModificationInstantiationBuilder>
-
setVariables
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<ProcessInstanceModificationInstantiationBuilder>
-
setVariablesLocal
public ProcessInstanceModificationInstantiationBuilder setVariablesLocal(Map<String, 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<ProcessInstanceModificationInstantiationBuilder>
-
setAnnotation
Description copied from interface:ProcessInstanceModificationBuilderProvides annotation for the current modification.- Specified by:
setAnnotationin interfaceProcessInstanceModificationBuilder
-
execute
public void execute()Description copied from interface:ProcessInstanceModificationBuilderExecute all instructions. Custom execution and task listeners, as well as task input output mappings are executed.- Specified by:
executein interfaceProcessInstanceModificationBuilder
-
execute
public void execute(boolean skipCustomListeners, boolean skipIoMappings) - Specified by:
executein 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
Description copied from interface:ProcessInstanceModificationBuilderExecute all instructions asynchronously. Custom execution and task listeners, as well as task input output mappings are executed.- Specified by:
executeAsyncin interfaceProcessInstanceModificationBuilder- Returns:
- a batch job to be executed by the executor
-
executeAsync
- Specified by:
executeAsyncin 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
-
getCommandContext
-
getProcessInstanceId
-
getModificationOperations
-
setModificationOperations
-
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
-
getModificationReason
-
setModificationReason
-
getAnnotation
-
setAnnotationInternal
-