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 Activity
protected VariableAggregationDefinitions
protected String
protected String
protected Expression
protected CollectionHandler
protected String
protected String
protected String
protected static final String
protected AbstractBpmnActivityBehavior
protected static final org.slf4j.Logger
protected Expression
protected static final String
protected static final String
protected static final String
Fields inherited from class org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
bpmnActivityBehavior
-
Constructor Summary
ConstructorsConstructorDescriptionMultiInstanceActivityBehavior
(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
aggregateVariablesForChildExecution
(DelegateExecution childExecution, DelegateExecution miRootExecution) Aggregated the variables for the finished child multi instance executionprotected void
aggregateVariablesOfAllInstances
(DelegateExecution multiInstanceRootExecution) Aggregates all variables that were stored before for each child instancebuildCompletedEvent
(DelegateExecution execution, FlowableEngineEventType eventType) protected String
protected void
callActivityEndListeners
(DelegateExecution execution) Since no transitions are followed when leaving the inner activity, it is needed to call the end listeners yourself.protected void
cleanupMiRoot
(DelegateExecution execution) void
completed
(DelegateExecution execution) called after the process instance is destroyed for this activity to perform its outgoing control flow logic.void
completing
(DelegateExecution execution, DelegateExecution subProcessInstance) called before the process instance is destroyed to allow this activity to extract data from the sub process instance.boolean
completionConditionSatisfied
(DelegateExecution execution) protected FlowableCollectionHandler
createFlowableCollectionHandler
(CollectionHandler handler, DelegateExecution execution) protected abstract int
createInstances
(DelegateExecution execution) void
execute
(DelegateExecution delegateExecution) Default behaviour: just leave the activity with no extra functionality.protected void
executeCompensationBoundaryEvents
(FlowElement flowElement, DelegateExecution execution) protected void
executeOriginalBehavior
(DelegateExecution execution, ExecutionEntity multiInstanceRootExecution, int loopCounter) protected Collection<BoundaryEvent>
findBoundaryEventsForFlowNode
(String processDefinitionId, FlowElement flowElement) protected String
getActiveValue
(String originalValue, String propertyName, com.fasterxml.jackson.databind.node.ObjectNode taskElementProperties) protected DelegateExecution
getInstanceExecution
(DelegateExecution execution) protected Integer
getLocalLoopVariable
(DelegateExecution execution, String variableName) getLoopVariable
(DelegateExecution execution, String variableName) getLoopVariableInstance
(DelegateExecution execution, String variableName) protected DelegateExecution
getMultiInstanceRootExecution
(DelegateExecution execution) protected Process
getProcessDefinition
(String processDefinitionId) protected boolean
protected void
internalInterrupted
(DelegateExecution execution) void
interrupted
(DelegateExecution execution) protected boolean
isExtraScopeNeeded
(FlowNode flowNode) protected Collection
iterableToCollection
(Iterable iterable) void
lastExecutionEnded
(DelegateExecution execution) void
leave
(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 void
logLoopDetails
(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances) protected Collection
resolveAndValidateCollection
(DelegateExecution execution) protected Object
resolveCollection
(DelegateExecution execution) protected int
resolveLoopCardinality
(DelegateExecution execution) protected int
resolveNrOfInstances
(DelegateExecution execution) protected void
sendCompletedEvent
(DelegateExecution execution) protected void
sendCompletedWithConditionEvent
(DelegateExecution execution) void
setAggregations
(VariableAggregationDefinitions aggregations) void
setCollectionElementIndexVariable
(String collectionElementIndexVariable) void
setCollectionElementVariable
(String collectionElementVariable) void
setCollectionExpression
(Expression collectionExpression) void
setCollectionString
(String collectionString) void
setCollectionVariable
(String collectionVariable) void
setCompletionCondition
(String completionCondition) void
setHandler
(CollectionHandler collectionHandler) void
setInnerActivityBehavior
(AbstractBpmnActivityBehavior innerActivityBehavior) void
setLoopCardinalityExpression
(Expression loopCardinalityExpression) protected void
setLoopVariable
(DelegateExecution execution, String variableName, Object value) void
trigger
(DelegateExecution execution, String signalName, Object signalData) protected boolean
Methods 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 originalActivityBehavior
of the activity that will be wrapped inside this behavior.
-
-
Method Details
-
execute
Description copied from class:FlowNodeActivityBehavior
Default behaviour: just leave the activity with no extra functionality.- Specified by:
execute
in interfaceActivityBehavior
- Overrides:
execute
in classFlowNodeActivityBehavior
-
createInstances
-
leave
Description copied from class:FlowNodeActivityBehavior
Default way of leaving a BPMN 2.0 activity: evaluate the conditions on the outgoing sequence flow and take those that evaluate to true.- Overrides:
leave
in 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:
trigger
in interfaceTriggerableActivityBehavior
- Overrides:
trigger
in classFlowNodeActivityBehavior
-
lastExecutionEnded
-
completing
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception Description copied from interface:SubProcessActivityBehavior
called 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:
completing
in interfaceSubProcessActivityBehavior
- Throws:
Exception
-
completed
Description copied from interface:SubProcessActivityBehavior
called after the process instance is destroyed for this activity to perform its outgoing control flow logic.- Specified by:
completed
in interfaceSubProcessActivityBehavior
- Throws:
Exception
-
interrupted
- Specified by:
interrupted
in 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
-