Class MultiInstanceActivityBehavior
java.lang.Object
org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior
- All Implemented Interfaces:
Serializable,ActivityBehavior,SubProcessActivityBehavior,TriggerableActivityBehavior
- Direct Known Subclasses:
ParallelMultiInstanceBehavior,SequentialMultiInstanceBehavior
public abstract class MultiInstanceActivityBehavior
extends FlowNodeActivityBehavior
implements SubProcessActivityBehavior
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Activityprotected Stringprotected Stringprotected Expressionprotected Stringprotected Expressionprotected AbstractBpmnActivityBehaviorprotected static final org.slf4j.Loggerprotected Expressionstatic final Stringstatic final Stringstatic final StringFields inherited from class org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
bpmnActivityBehavior -
Constructor Summary
ConstructorsConstructorDescriptionMultiInstanceActivityBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcallActivityEndListeners(DelegateExecution execution) Since no transitions are followed when leaving the inner activity, it is needed to call the end listeners yourself.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.protected booleancompletionConditionSatisfied(DelegateExecution execution) protected abstract intcreateInstances(DelegateExecution execution) protected voiddispatchActivityCompletedEvent(DelegateExecution execution) voidexecute(DelegateExecution execution) Default behaviour: just leave the activity with no extra functionality.protected voidexecuteCompensationBoundaryEvents(FlowElement flowElement, DelegateExecution execution) protected voidexecuteOriginalBehavior(DelegateExecution execution, int loopCounter) protected Collection<BoundaryEvent>findBoundaryEventsForFlowNode(String processDefinitionId, FlowElement flowElement) protected CommandContextprotected IntegergetLocalLoopVariable(DelegateExecution execution, String variableName) protected IntegergetLoopVariable(DelegateExecution execution, String variableName) protected DelegateExecutiongetMultiInstanceRootExecution(DelegateExecution executionEntity) protected ProcessgetProcessDefinition(String processDefinitionId) protected ObjectgetResultElementItem(Map<String, Object> availableVariables) protected ObjectgetResultElementItem(DelegateExecution childExecution) booleanbooleanprotected booleanisExtraScopeNeeded(FlowNode flowNode) voidlastExecutionEnded(DelegateExecution execution) protected voidlogLoopDetails(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances) protected voidpropagateLoopDataOutputRefToProcessInstance(ExecutionEntity miRootExecution) protected voidremoveLocalLoopVariable(DelegateExecution execution, String variableName) protected CollectionresolveAndValidateCollection(DelegateExecution execution) protected ObjectresolveCollection(DelegateExecution execution) protected intresolveLoopCardinality(DelegateExecution execution) protected intresolveNrOfInstances(DelegateExecution execution) voidsetCollectionElementIndexVariable(String collectionElementIndexVariable) voidsetCollectionElementVariable(String collectionElementVariable) voidsetCollectionExpression(Expression collectionExpression) voidsetCollectionVariable(String collectionVariable) voidsetCompletionConditionExpression(Expression completionConditionExpression) voidsetInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior) voidsetLoopCardinalityExpression(Expression loopCardinalityExpression) voidsetLoopDataOutputRef(String loopDataOutputRef) protected voidsetLoopVariable(DelegateExecution execution, String variableName, Object value) voidsetOutputDataItem(String outputDataItem) voidtrigger(DelegateExecution execution, String signalName, Object signalData) protected voidupdateResultCollection(DelegateExecution childExecution, DelegateExecution miRootExecution) protected booleanMethods inherited from class org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
leave, leaveIgnoreConditions, parseActivityType
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
NUMBER_OF_INSTANCES
- See Also:
-
NUMBER_OF_ACTIVE_INSTANCES
- See Also:
-
NUMBER_OF_COMPLETED_INSTANCES
- See Also:
-
activity
-
innerActivityBehavior
-
loopCardinalityExpression
-
completionConditionExpression
-
collectionExpression
-
collectionVariable
-
collectionElementVariable
-
collectionElementIndexVariable
-
-
Constructor Details
-
MultiInstanceActivityBehavior
public MultiInstanceActivityBehavior(Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior) - Parameters:
activity- TheActivitywhich has multi instance behaviourinnerActivityBehavior- 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
-
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
-
resolveNrOfInstances
-
executeOriginalBehavior
-
resolveAndValidateCollection
-
resolveCollection
-
usesCollection
protected boolean usesCollection() -
isExtraScopeNeeded
-
resolveLoopCardinality
-
completionConditionSatisfied
-
setLoopVariable
-
getLoopVariable
-
getLocalLoopVariable
-
removeLocalLoopVariable
-
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
-
dispatchActivityCompletedEvent
-
getLoopCardinalityExpression
-
setLoopCardinalityExpression
-
getCompletionConditionExpression
-
setCompletionConditionExpression
-
getCollectionExpression
-
setCollectionExpression
-
getCollectionVariable
-
setCollectionVariable
-
getCollectionElementVariable
-
setCollectionElementVariable
-
getCollectionElementIndexVariable
-
setCollectionElementIndexVariable
-
setInnerActivityBehavior
-
getInnerActivityBehavior
-
getLoopDataOutputRef
-
hasLoopDataOutputRef
public boolean hasLoopDataOutputRef() -
setLoopDataOutputRef
-
getOutputDataItem
-
hasOutputDataItem
public boolean hasOutputDataItem() -
setOutputDataItem
-
updateResultCollection
protected void updateResultCollection(DelegateExecution childExecution, DelegateExecution miRootExecution) -
getResultElementItem
-
getCommandContext
-
getResultElementItem
-
propagateLoopDataOutputRefToProcessInstance
-