Class MultiInstanceActivityBehavior
java.lang.Object
org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
org.flowable.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior
- All Implemented Interfaces:
Serializable,ActivityBehavior,InterruptibleActivityBehaviour,SubProcessActivityBehavior,TriggerableActivityBehavior
- Direct Known Subclasses:
ParallelMultiInstanceBehavior,SequentialMultiInstanceBehavior
public abstract class MultiInstanceActivityBehavior
extends FlowNodeActivityBehavior
implements SubProcessActivityBehavior, InterruptibleActivityBehaviour
Implementation of the multi-instance functionality as described in the BPMN 2.0 spec.
Multi instance functionality is implemented as an
ActivityBehavior that wraps the original ActivityBehavior of the activity.
Only subclasses of AbstractBpmnActivityBehavior can have multi-instance behavior. As such, special logic is contained in the AbstractBpmnActivityBehavior to delegate to the
MultiInstanceActivityBehavior if needed.- Author:
- Joram Barrez, Tijs Rademakers, Filip Hrisafov
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Activityprotected VariableAggregationDefinitionsprotected Stringprotected Stringprotected Expressionprotected CollectionHandlerprotected Stringprotected Stringprotected Stringprotected static final Stringprotected AbstractBpmnActivityBehaviorprotected static final org.slf4j.Loggerprotected Expressionprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
bpmnActivityBehavior -
Constructor Summary
ConstructorsConstructorDescriptionMultiInstanceActivityBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaggregateVariablesForChildExecution(DelegateExecution childExecution, DelegateExecution miRootExecution) Aggregated the variables for the finished child multi instance executionprotected voidaggregateVariablesOfAllInstances(DelegateExecution multiInstanceRootExecution) Aggregates all variables that were stored before for each child instancebuildCompletedEvent(DelegateExecution execution, FlowableEngineEventType eventType) protected Stringprotected voidcallActivityEndListeners(DelegateExecution execution) Since no transitions are followed when leaving the inner activity, it is needed to call the end listeners yourself.protected voidcleanupMiRoot(DelegateExecution execution) voidcompleted(DelegateExecution execution) called after the process instance is destroyed for this activity to perform its outgoing control flow logic.voidcompleting(DelegateExecution execution, DelegateExecution subProcessInstance) called before the process instance is destroyed to allow this activity to extract data from the sub process instance.booleancompletionConditionSatisfied(DelegateExecution execution) protected FlowableCollectionHandlercreateFlowableCollectionHandler(CollectionHandler handler, DelegateExecution execution) protected abstract intcreateInstances(DelegateExecution execution) voidexecute(DelegateExecution delegateExecution) Default behaviour: just leave the activity with no extra functionality.protected voidexecuteCompensationBoundaryEvents(FlowElement flowElement, DelegateExecution execution) protected voidexecuteOriginalBehavior(DelegateExecution execution, ExecutionEntity multiInstanceRootExecution, int loopCounter) protected Collection<BoundaryEvent>findBoundaryEventsForFlowNode(String processDefinitionId, FlowElement flowElement) protected StringgetActiveValue(String originalValue, String propertyName, com.fasterxml.jackson.databind.node.ObjectNode taskElementProperties) protected DelegateExecutiongetInstanceExecution(DelegateExecution execution) protected IntegergetLocalLoopVariable(DelegateExecution execution, String variableName) getLoopVariable(DelegateExecution execution, String variableName) getLoopVariableInstance(DelegateExecution execution, String variableName) protected DelegateExecutiongetMultiInstanceRootExecution(DelegateExecution execution) protected ProcessgetProcessDefinition(String processDefinitionId) protected booleanprotected voidinternalInterrupted(DelegateExecution execution) voidinterrupted(DelegateExecution execution) protected booleanisExtraScopeNeeded(FlowNode flowNode) protected CollectioniterableToCollection(Iterable iterable) voidlastExecutionEnded(DelegateExecution execution) voidleave(DelegateExecution execution) Default way of leaving a BPMN 2.0 activity: evaluate the conditions on the outgoing sequence flow and take those that evaluate to true.protected voidlogLoopDetails(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances) protected CollectionresolveAndValidateCollection(DelegateExecution execution) protected ObjectresolveCollection(DelegateExecution execution) protected intresolveLoopCardinality(DelegateExecution execution) protected intresolveNrOfInstances(DelegateExecution execution) protected voidsendCompletedEvent(DelegateExecution execution) protected voidsendCompletedWithConditionEvent(DelegateExecution execution) voidsetAggregations(VariableAggregationDefinitions aggregations) voidsetCollectionElementIndexVariable(String collectionElementIndexVariable) voidsetCollectionElementVariable(String collectionElementVariable) voidsetCollectionExpression(Expression collectionExpression) voidsetCollectionString(String collectionString) voidsetCollectionVariable(String collectionVariable) voidsetCompletionCondition(String completionCondition) voidsetHandler(CollectionHandler collectionHandler) voidsetInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior) voidsetLoopCardinalityExpression(Expression loopCardinalityExpression) protected voidsetLoopVariable(DelegateExecution execution, String variableName, Object value) voidtrigger(DelegateExecution execution, String signalName, Object signalData) protected booleanMethods inherited from class org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
leaveIgnoreConditions, parseActivityType
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
DELETE_REASON_END
- See Also:
-
NUMBER_OF_INSTANCES
- See Also:
-
NUMBER_OF_ACTIVE_INSTANCES
- See Also:
-
NUMBER_OF_COMPLETED_INSTANCES
- See Also:
-
activity
-
innerActivityBehavior
-
loopCardinalityExpression
-
completionCondition
-
collectionExpression
-
collectionVariable
-
collectionElementVariable
-
collectionString
-
collectionHandler
-
aggregations
-
collectionElementIndexVariable
-
-
Constructor Details
-
MultiInstanceActivityBehavior
public MultiInstanceActivityBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) - Parameters:
innerActivityBehavior- The originalActivityBehaviorof the activity that will be wrapped inside this behavior.
-
-
Method Details
-
execute
Description copied from class:FlowNodeActivityBehaviorDefault behaviour: just leave the activity with no extra functionality.- Specified by:
executein interfaceActivityBehavior- Overrides:
executein classFlowNodeActivityBehavior
-
createInstances
-
leave
Description copied from class:FlowNodeActivityBehaviorDefault way of leaving a BPMN 2.0 activity: evaluate the conditions on the outgoing sequence flow and take those that evaluate to true.- Overrides:
leavein classFlowNodeActivityBehavior
-
hasVariableAggregationDefinitions
-
aggregateVariablesForChildExecution
protected void aggregateVariablesForChildExecution(DelegateExecution childExecution, DelegateExecution miRootExecution) Aggregated the variables for the finished child multi instance execution- Parameters:
childExecution- the child executionmiRootExecution- the multi instance root execution
-
aggregateVariablesOfAllInstances
Aggregates all variables that were stored before for each child instance -
cleanupMiRoot
-
executeCompensationBoundaryEvents
protected void executeCompensationBoundaryEvents(FlowElement flowElement, DelegateExecution execution) -
findBoundaryEventsForFlowNode
protected Collection<BoundaryEvent> findBoundaryEventsForFlowNode(String processDefinitionId, FlowElement flowElement) -
getProcessDefinition
-
trigger
- Specified by:
triggerin interfaceTriggerableActivityBehavior- Overrides:
triggerin classFlowNodeActivityBehavior
-
lastExecutionEnded
-
completing
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception Description copied from interface:SubProcessActivityBehaviorcalled before the process instance is destroyed to allow this activity to extract data from the sub process instance. No control flow should be done on the execution yet.- Specified by:
completingin interfaceSubProcessActivityBehavior- Throws:
Exception
-
completed
Description copied from interface:SubProcessActivityBehaviorcalled after the process instance is destroyed for this activity to perform its outgoing control flow logic.- Specified by:
completedin interfaceSubProcessActivityBehavior- Throws:
Exception
-
interrupted
- Specified by:
interruptedin interfaceInterruptibleActivityBehaviour
-
internalInterrupted
-
completionConditionSatisfied
-
getLoopVariable
-
getLoopVariableInstance
-
sendCompletedWithConditionEvent
-
sendCompletedEvent
-
buildCompletedEvent
protected FlowableMultiInstanceActivityCompletedEvent buildCompletedEvent(DelegateExecution execution, FlowableEngineEventType eventType) -
resolveNrOfInstances
-
executeOriginalBehavior
protected void executeOriginalBehavior(DelegateExecution execution, ExecutionEntity multiInstanceRootExecution, int loopCounter) -
resolveAndValidateCollection
-
buildUnresolvedCollectionExceptionMessage
-
iterableToCollection
-
resolveCollection
-
usesCollection
protected boolean usesCollection() -
isExtraScopeNeeded
-
resolveLoopCardinality
-
setLoopVariable
-
getLocalLoopVariable
-
callActivityEndListeners
Since no transitions are followed when leaving the inner activity, it is needed to call the end listeners yourself. -
logLoopDetails
protected void logLoopDetails(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances) -
getMultiInstanceRootExecution
-
getInstanceExecution
-
getActiveValue
-
createFlowableCollectionHandler
protected FlowableCollectionHandler createFlowableCollectionHandler(CollectionHandler handler, DelegateExecution execution) -
getLoopCardinalityExpression
-
setLoopCardinalityExpression
-
getCompletionCondition
-
setCompletionCondition
-
getCollectionExpression
-
setCollectionExpression
-
getCollectionVariable
-
setCollectionVariable
-
getCollectionElementVariable
-
setCollectionElementVariable
-
getCollectionString
-
setCollectionString
-
getHandler
-
setHandler
-
getAggregations
-
setAggregations
-
getCollectionElementIndexVariable
-
setCollectionElementIndexVariable
-
setInnerActivityBehavior
-
getInnerActivityBehavior
-