Class MultiInstanceActivityBehavior
- java.lang.Object
-
- org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
-
- org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior
-
- All Implemented Interfaces:
java.io.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 anActivityBehaviorthat wraps the originalActivityBehaviorof the activity. Only subclasses ofAbstractBpmnActivityBehaviorcan have multi-instance behavior. As such, special logic is contained in theAbstractBpmnActivityBehaviorto delegate to theMultiInstanceActivityBehaviorif needed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.activiti.bpmn.model.Activityactivityprotected java.lang.StringcollectionElementIndexVariableprotected java.lang.StringcollectionElementVariableprotected ExpressioncollectionExpressionprotected java.lang.StringcollectionVariableprotected ExpressioncompletionConditionExpressionprotected AbstractBpmnActivityBehaviorinnerActivityBehaviorprotected static org.slf4j.LoggerLOGGERprotected ExpressionloopCardinalityExpressionprotected static java.lang.StringNUMBER_OF_ACTIVE_INSTANCESprotected static java.lang.StringNUMBER_OF_COMPLETED_INSTANCESprotected static java.lang.StringNUMBER_OF_INSTANCES-
Fields inherited from class org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
bpmnActivityBehavior
-
-
Constructor Summary
Constructors Constructor Description MultiInstanceActivityBehavior(org.activiti.bpmn.model.Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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(org.activiti.bpmn.model.FlowElement flowElement, DelegateExecution execution)protected voidexecuteOriginalBehavior(DelegateExecution execution, int loopCounter)protected java.util.Collection<org.activiti.bpmn.model.BoundaryEvent>findBoundaryEventsForFlowNode(java.lang.String processDefinitionId, org.activiti.bpmn.model.FlowElement flowElement)java.lang.StringgetCollectionElementIndexVariable()java.lang.StringgetCollectionElementVariable()ExpressiongetCollectionExpression()java.lang.StringgetCollectionVariable()ExpressiongetCompletionConditionExpression()AbstractBpmnActivityBehaviorgetInnerActivityBehavior()protected java.lang.IntegergetLocalLoopVariable(DelegateExecution execution, java.lang.String variableName)ExpressiongetLoopCardinalityExpression()java.lang.StringgetLoopDataOutputRef()protected java.lang.IntegergetLoopVariable(DelegateExecution execution, java.lang.String variableName)protected DelegateExecutiongetMultiInstanceRootExecution(DelegateExecution executionEntity)java.lang.StringgetOutputDataItem()protected org.activiti.bpmn.model.ProcessgetProcessDefinition(java.lang.String processDefinitionId)booleanhasLoopDataOutputRef()protected booleanisExtraScopeNeeded(org.activiti.bpmn.model.FlowNode flowNode)voidlastExecutionEnded(DelegateExecution execution)protected voidlogLoopDetails(DelegateExecution execution, java.lang.String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances)protected voidpropagateLoopDataOutputRefToProcessInstance(ExecutionEntity miRootExecution)protected voidremoveLocalLoopVariable(DelegateExecution execution, java.lang.String variableName)protected java.util.CollectionresolveAndValidateCollection(DelegateExecution execution)protected java.lang.ObjectresolveCollection(DelegateExecution execution)protected intresolveLoopCardinality(DelegateExecution execution)protected intresolveNrOfInstances(DelegateExecution execution)voidsetCollectionElementIndexVariable(java.lang.String collectionElementIndexVariable)voidsetCollectionElementVariable(java.lang.String collectionElementVariable)voidsetCollectionExpression(Expression collectionExpression)voidsetCollectionVariable(java.lang.String collectionVariable)voidsetCompletionConditionExpression(Expression completionConditionExpression)voidsetInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)voidsetLoopCardinalityExpression(Expression loopCardinalityExpression)voidsetLoopDataOutputRef(java.lang.String loopDataOutputRef)protected voidsetLoopVariable(DelegateExecution execution, java.lang.String variableName, java.lang.Object value)voidsetOutputDataItem(java.lang.String outputDataItem)voidtrigger(DelegateExecution execution, java.lang.String signalName, java.lang.Object signalData)protected voidupdateResultCollection(DelegateExecution childExecution, DelegateExecution miRootExecution)protected booleanusesCollection()-
Methods inherited from class org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
leave, leaveIgnoreConditions, parseActivityType
-
-
-
-
Field Detail
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
NUMBER_OF_INSTANCES
protected static final java.lang.String NUMBER_OF_INSTANCES
- See Also:
- Constant Field Values
-
NUMBER_OF_ACTIVE_INSTANCES
protected static final java.lang.String NUMBER_OF_ACTIVE_INSTANCES
- See Also:
- Constant Field Values
-
NUMBER_OF_COMPLETED_INSTANCES
protected static final java.lang.String NUMBER_OF_COMPLETED_INSTANCES
- See Also:
- Constant Field Values
-
activity
protected org.activiti.bpmn.model.Activity activity
-
innerActivityBehavior
protected AbstractBpmnActivityBehavior innerActivityBehavior
-
loopCardinalityExpression
protected Expression loopCardinalityExpression
-
completionConditionExpression
protected Expression completionConditionExpression
-
collectionExpression
protected Expression collectionExpression
-
collectionVariable
protected java.lang.String collectionVariable
-
collectionElementVariable
protected java.lang.String collectionElementVariable
-
collectionElementIndexVariable
protected java.lang.String collectionElementIndexVariable
-
-
Constructor Detail
-
MultiInstanceActivityBehavior
public MultiInstanceActivityBehavior(org.activiti.bpmn.model.Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior)- Parameters:
innerActivityBehavior- The originalActivityBehaviorof the activity that will be wrapped inside this behavior.isSequential- Indicates whether the multi instance behavior must be sequential or parallel
-
-
Method Detail
-
execute
public void execute(DelegateExecution execution)
Description copied from class:FlowNodeActivityBehaviorDefault behaviour: just leave the activity with no extra functionality.- Specified by:
executein interfaceActivityBehavior- Overrides:
executein classFlowNodeActivityBehavior
-
createInstances
protected abstract int createInstances(DelegateExecution execution)
-
executeCompensationBoundaryEvents
protected void executeCompensationBoundaryEvents(org.activiti.bpmn.model.FlowElement flowElement, DelegateExecution execution)
-
findBoundaryEventsForFlowNode
protected java.util.Collection<org.activiti.bpmn.model.BoundaryEvent> findBoundaryEventsForFlowNode(java.lang.String processDefinitionId, org.activiti.bpmn.model.FlowElement flowElement)
-
getProcessDefinition
protected org.activiti.bpmn.model.Process getProcessDefinition(java.lang.String processDefinitionId)
-
trigger
public void trigger(DelegateExecution execution, java.lang.String signalName, java.lang.Object signalData)
- Specified by:
triggerin interfaceTriggerableActivityBehavior- Overrides:
triggerin classFlowNodeActivityBehavior
-
lastExecutionEnded
public void lastExecutionEnded(DelegateExecution execution)
-
completing
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws java.lang.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:
java.lang.Exception
-
completed
public void completed(DelegateExecution execution) throws java.lang.Exception
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:
java.lang.Exception
-
resolveNrOfInstances
protected int resolveNrOfInstances(DelegateExecution execution)
-
executeOriginalBehavior
protected void executeOriginalBehavior(DelegateExecution execution, int loopCounter)
-
resolveAndValidateCollection
protected java.util.Collection resolveAndValidateCollection(DelegateExecution execution)
-
resolveCollection
protected java.lang.Object resolveCollection(DelegateExecution execution)
-
usesCollection
protected boolean usesCollection()
-
isExtraScopeNeeded
protected boolean isExtraScopeNeeded(org.activiti.bpmn.model.FlowNode flowNode)
-
resolveLoopCardinality
protected int resolveLoopCardinality(DelegateExecution execution)
-
completionConditionSatisfied
protected boolean completionConditionSatisfied(DelegateExecution execution)
-
setLoopVariable
protected void setLoopVariable(DelegateExecution execution, java.lang.String variableName, java.lang.Object value)
-
getLoopVariable
protected java.lang.Integer getLoopVariable(DelegateExecution execution, java.lang.String variableName)
-
getLocalLoopVariable
protected java.lang.Integer getLocalLoopVariable(DelegateExecution execution, java.lang.String variableName)
-
removeLocalLoopVariable
protected void removeLocalLoopVariable(DelegateExecution execution, java.lang.String variableName)
-
callActivityEndListeners
protected void callActivityEndListeners(DelegateExecution execution)
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, java.lang.String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances)
-
getMultiInstanceRootExecution
protected DelegateExecution getMultiInstanceRootExecution(DelegateExecution executionEntity)
-
dispatchActivityCompletedEvent
protected void dispatchActivityCompletedEvent(DelegateExecution execution)
-
getLoopCardinalityExpression
public Expression getLoopCardinalityExpression()
-
setLoopCardinalityExpression
public void setLoopCardinalityExpression(Expression loopCardinalityExpression)
-
getCompletionConditionExpression
public Expression getCompletionConditionExpression()
-
setCompletionConditionExpression
public void setCompletionConditionExpression(Expression completionConditionExpression)
-
getCollectionExpression
public Expression getCollectionExpression()
-
setCollectionExpression
public void setCollectionExpression(Expression collectionExpression)
-
getCollectionVariable
public java.lang.String getCollectionVariable()
-
setCollectionVariable
public void setCollectionVariable(java.lang.String collectionVariable)
-
getCollectionElementVariable
public java.lang.String getCollectionElementVariable()
-
setCollectionElementVariable
public void setCollectionElementVariable(java.lang.String collectionElementVariable)
-
getCollectionElementIndexVariable
public java.lang.String getCollectionElementIndexVariable()
-
setCollectionElementIndexVariable
public void setCollectionElementIndexVariable(java.lang.String collectionElementIndexVariable)
-
setInnerActivityBehavior
public void setInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)
-
getInnerActivityBehavior
public AbstractBpmnActivityBehavior getInnerActivityBehavior()
-
getLoopDataOutputRef
public java.lang.String getLoopDataOutputRef()
-
hasLoopDataOutputRef
public boolean hasLoopDataOutputRef()
-
setLoopDataOutputRef
public void setLoopDataOutputRef(java.lang.String loopDataOutputRef)
-
getOutputDataItem
public java.lang.String getOutputDataItem()
-
setOutputDataItem
public void setOutputDataItem(java.lang.String outputDataItem)
-
updateResultCollection
protected void updateResultCollection(DelegateExecution childExecution, DelegateExecution miRootExecution)
-
propagateLoopDataOutputRefToProcessInstance
protected void propagateLoopDataOutputRefToProcessInstance(ExecutionEntity miRootExecution)
-
-