public abstract class MultiInstanceActivityBehavior extends FlowNodeActivityBehavior implements SubProcessActivityBehavior
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.Modifier and Type | Field and Description |
---|---|
protected org.activiti.bpmn.model.Activity |
activity |
protected String |
collectionElementIndexVariable |
protected String |
collectionElementVariable |
protected Expression |
collectionExpression |
protected String |
collectionVariable |
protected Expression |
completionConditionExpression |
protected AbstractBpmnActivityBehavior |
innerActivityBehavior |
protected static org.slf4j.Logger |
LOGGER |
protected Expression |
loopCardinalityExpression |
protected String |
NUMBER_OF_ACTIVE_INSTANCES |
protected String |
NUMBER_OF_COMPLETED_INSTANCES |
protected String |
NUMBER_OF_INSTANCES |
bpmnActivityBehavior
Constructor and Description |
---|
MultiInstanceActivityBehavior(org.activiti.bpmn.model.Activity activity,
AbstractBpmnActivityBehavior innerActivityBehavior) |
Modifier and Type | Method and Description |
---|---|
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 |
callCustomActivityStartListeners(DelegateExecution execution)
Since the first loop of the multi instance is not executed as a regular activity,
it is needed to call the start listeners yourself.
|
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.
|
protected boolean |
completionConditionSatisfied(DelegateExecution execution) |
protected abstract int |
createInstances(DelegateExecution execution) |
void |
execute(DelegateExecution execution)
Default behaviour: just leave the activity with no extra functionality.
|
protected void |
executeCompensationBoundaryEvents(org.activiti.bpmn.model.FlowElement flowElement,
DelegateExecution execution) |
protected void |
executeOriginalBehavior(DelegateExecution execution,
int loopCounter) |
protected Collection<org.activiti.bpmn.model.BoundaryEvent> |
findBoundaryEventsForFlowNode(String processDefinitionId,
org.activiti.bpmn.model.FlowElement flowElement) |
String |
getCollectionElementIndexVariable() |
String |
getCollectionElementVariable() |
Expression |
getCollectionExpression() |
String |
getCollectionVariable() |
Expression |
getCompletionConditionExpression() |
AbstractBpmnActivityBehavior |
getInnerActivityBehavior() |
protected Integer |
getLocalLoopVariable(DelegateExecution execution,
String variableName) |
Expression |
getLoopCardinalityExpression() |
protected Integer |
getLoopVariable(DelegateExecution execution,
String variableName) |
protected DelegateExecution |
getMultiInstanceRootExecution(DelegateExecution executionEntity) |
protected org.activiti.bpmn.model.Process |
getProcessDefinition(String processDefinitionId) |
protected boolean |
isExtraScopeNeeded(org.activiti.bpmn.model.FlowNode flowNode) |
void |
lastExecutionEnded(DelegateExecution execution) |
protected void |
logLoopDetails(DelegateExecution execution,
String custom,
int loopCounter,
int nrOfCompletedInstances,
int nrOfActiveInstances,
int nrOfInstances) |
protected void |
removeLocalLoopVariable(DelegateExecution execution,
String variableName) |
protected int |
resolveLoopCardinality(DelegateExecution execution) |
protected int |
resolveNrOfInstances(DelegateExecution execution) |
void |
setCollectionElementIndexVariable(String collectionElementIndexVariable) |
void |
setCollectionElementVariable(String collectionElementVariable) |
void |
setCollectionExpression(Expression collectionExpression) |
void |
setCollectionVariable(String collectionVariable) |
void |
setCompletionConditionExpression(Expression completionConditionExpression) |
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 |
usesCollection() |
leave, leaveIgnoreConditions, parseActivityType
protected static final org.slf4j.Logger LOGGER
protected final String NUMBER_OF_INSTANCES
protected final String NUMBER_OF_ACTIVE_INSTANCES
protected final String NUMBER_OF_COMPLETED_INSTANCES
protected org.activiti.bpmn.model.Activity activity
protected AbstractBpmnActivityBehavior innerActivityBehavior
protected Expression loopCardinalityExpression
protected Expression completionConditionExpression
protected Expression collectionExpression
protected String collectionVariable
protected String collectionElementVariable
protected String collectionElementIndexVariable
public MultiInstanceActivityBehavior(org.activiti.bpmn.model.Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior)
innerActivityBehavior
- The original ActivityBehavior
of the activity that will be wrapped inside this behavior.isSequential
- Indicates whether the multi instance behavior must be sequential or parallelpublic void execute(DelegateExecution execution)
FlowNodeActivityBehavior
execute
in interface ActivityBehavior
execute
in class FlowNodeActivityBehavior
protected abstract int createInstances(DelegateExecution execution)
protected void executeCompensationBoundaryEvents(org.activiti.bpmn.model.FlowElement flowElement, DelegateExecution execution)
protected Collection<org.activiti.bpmn.model.BoundaryEvent> findBoundaryEventsForFlowNode(String processDefinitionId, org.activiti.bpmn.model.FlowElement flowElement)
protected org.activiti.bpmn.model.Process getProcessDefinition(String processDefinitionId)
public void trigger(DelegateExecution execution, String signalName, Object signalData)
trigger
in interface TriggerableActivityBehavior
trigger
in class FlowNodeActivityBehavior
public void lastExecutionEnded(DelegateExecution execution)
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception
SubProcessActivityBehavior
completing
in interface SubProcessActivityBehavior
Exception
public void completed(DelegateExecution execution) throws Exception
SubProcessActivityBehavior
completed
in interface SubProcessActivityBehavior
Exception
protected int resolveNrOfInstances(DelegateExecution execution)
protected void executeOriginalBehavior(DelegateExecution execution, int loopCounter)
protected boolean usesCollection()
protected boolean isExtraScopeNeeded(org.activiti.bpmn.model.FlowNode flowNode)
protected int resolveLoopCardinality(DelegateExecution execution)
protected boolean completionConditionSatisfied(DelegateExecution execution)
protected void setLoopVariable(DelegateExecution execution, String variableName, Object value)
protected Integer getLoopVariable(DelegateExecution execution, String variableName)
protected Integer getLocalLoopVariable(DelegateExecution execution, String variableName)
protected void removeLocalLoopVariable(DelegateExecution execution, String variableName)
protected void callCustomActivityStartListeners(DelegateExecution execution)
protected void callActivityEndListeners(DelegateExecution execution)
protected void logLoopDetails(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances)
protected DelegateExecution getMultiInstanceRootExecution(DelegateExecution executionEntity)
public Expression getLoopCardinalityExpression()
public void setLoopCardinalityExpression(Expression loopCardinalityExpression)
public Expression getCompletionConditionExpression()
public void setCompletionConditionExpression(Expression completionConditionExpression)
public Expression getCollectionExpression()
public void setCollectionExpression(Expression collectionExpression)
public String getCollectionVariable()
public void setCollectionVariable(String collectionVariable)
public String getCollectionElementVariable()
public void setCollectionElementVariable(String collectionElementVariable)
public String getCollectionElementIndexVariable()
public void setCollectionElementIndexVariable(String collectionElementIndexVariable)
public void setInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)
public AbstractBpmnActivityBehavior getInnerActivityBehavior()
Copyright © 2015 Alfresco. All rights reserved.