public abstract class MultiInstanceActivityBehavior extends FlowNodeActivityBehavior implements CompositeActivityBehavior, 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 ActivityImpl |
activity |
protected String |
collectionElementVariable |
protected Expression |
collectionExpression |
protected String |
collectionVariable |
protected Expression |
completionConditionExpression |
protected AbstractBpmnActivityBehavior |
innerActivityBehavior |
protected static Logger |
LOGGER |
protected String |
LOOP_COUNTER |
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(ActivityImpl activity,
AbstractBpmnActivityBehavior innerActivityBehavior) |
Modifier and Type | Method and Description |
---|---|
protected void |
callActivityEndListeners(ActivityExecution execution)
Since no transitions are followed when leaving the inner activity,
it is needed to call the end listeners yourself.
|
void |
completed(ActivityExecution 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(ActivityExecution execution) |
protected abstract void |
createInstances(ActivityExecution execution,
int nrOfInstances) |
protected boolean |
createInstancesIfPossible(ActivityExecution execution)
protects the createInstance method - it is only called if the numberOfInstances is valid
(negative is invalid -> exception; zero means the sub instances are skipped)
Returns true if instances were created
|
void |
execute(ActivityExecution execution)
Default behaviour: just leave the activity with no extra functionality.
|
protected void |
executeOriginalBehavior(ActivityExecution execution,
int loopCounter) |
String |
getCollectionElementVariable() |
Expression |
getCollectionExpression() |
String |
getCollectionVariable() |
Expression |
getCompletionConditionExpression() |
protected Integer |
getLocalLoopVariable(ActivityExecution execution,
String variableName) |
Expression |
getLoopCardinalityExpression() |
protected Integer |
getLoopVariable(ActivityExecution execution,
String variableName) |
boolean |
isExtraScopeNeeded() |
void |
lastExecutionEnded(ActivityExecution execution) |
protected void |
logLoopDetails(ActivityExecution execution,
String custom,
int loopCounter,
int nrOfCompletedInstances,
int nrOfActiveInstances,
int nrOfInstances) |
protected int |
resolveLoopCardinality(ActivityExecution execution) |
protected int |
resolveNrOfInstances(ActivityExecution execution) |
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(ActivityExecution execution,
String variableName,
Object value) |
void |
signal(ActivityExecution execution,
String signalName,
Object signalData) |
protected boolean |
usesCollection() |
leave, leaveIgnoreConditions
protected static final Logger LOGGER
protected final String NUMBER_OF_INSTANCES
protected final String NUMBER_OF_ACTIVE_INSTANCES
protected final String NUMBER_OF_COMPLETED_INSTANCES
protected final String LOOP_COUNTER
protected ActivityImpl activity
protected AbstractBpmnActivityBehavior innerActivityBehavior
protected Expression loopCardinalityExpression
protected Expression completionConditionExpression
protected Expression collectionExpression
protected String collectionVariable
protected String collectionElementVariable
public MultiInstanceActivityBehavior(ActivityImpl 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(ActivityExecution execution) throws Exception
FlowNodeActivityBehavior
execute
in interface ActivityBehavior
execute
in class FlowNodeActivityBehavior
Exception
protected boolean createInstancesIfPossible(ActivityExecution execution) throws Exception
Exception
protected abstract void createInstances(ActivityExecution execution, int nrOfInstances) throws Exception
Exception
public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception
signal
in interface SignallableActivityBehavior
signal
in class FlowNodeActivityBehavior
Exception
public void lastExecutionEnded(ActivityExecution execution)
lastExecutionEnded
in interface CompositeActivityBehavior
public void completing(DelegateExecution execution, DelegateExecution subProcessInstance) throws Exception
SubProcessActivityBehavior
completing
in interface SubProcessActivityBehavior
Exception
public void completed(ActivityExecution execution) throws Exception
SubProcessActivityBehavior
completed
in interface SubProcessActivityBehavior
Exception
protected int resolveNrOfInstances(ActivityExecution execution)
protected void executeOriginalBehavior(ActivityExecution execution, int loopCounter) throws Exception
Exception
protected boolean usesCollection()
public boolean isExtraScopeNeeded()
protected int resolveLoopCardinality(ActivityExecution execution)
protected boolean completionConditionSatisfied(ActivityExecution execution)
protected void setLoopVariable(ActivityExecution execution, String variableName, Object value)
protected Integer getLoopVariable(ActivityExecution execution, String variableName)
protected Integer getLocalLoopVariable(ActivityExecution execution, String variableName)
protected void callActivityEndListeners(ActivityExecution execution)
protected void logLoopDetails(ActivityExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances)
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 void setInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)
Copyright © 2015. All rights reserved.