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 Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • NUMBER_OF_INSTANCES

      public static final String NUMBER_OF_INSTANCES
      See Also:
    • NUMBER_OF_ACTIVE_INSTANCES

      public static final String NUMBER_OF_ACTIVE_INSTANCES
      See Also:
    • NUMBER_OF_COMPLETED_INSTANCES

      public static final String NUMBER_OF_COMPLETED_INSTANCES
      See Also:
    • 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 String collectionVariable
    • collectionElementVariable

      protected String collectionElementVariable
    • collectionElementIndexVariable

      protected String collectionElementIndexVariable
  • Constructor Details

    • MultiInstanceActivityBehavior

      public MultiInstanceActivityBehavior(org.activiti.bpmn.model.Activity activity, AbstractBpmnActivityBehavior innerActivityBehavior)
      Parameters:
      activity - The Activity which has multi instance behaviour
      innerActivityBehavior - The original ActivityBehavior of the activity that will be wrapped inside this behavior.
  • Method Details

    • execute

      public void execute(DelegateExecution execution)
      Description copied from class: FlowNodeActivityBehavior
      Default behaviour: just leave the activity with no extra functionality.
      Specified by:
      execute in interface ActivityBehavior
      Overrides:
      execute in class FlowNodeActivityBehavior
    • createInstances

      protected abstract int createInstances(DelegateExecution execution)
    • executeCompensationBoundaryEvents

      protected void executeCompensationBoundaryEvents(org.activiti.bpmn.model.FlowElement flowElement, DelegateExecution execution)
    • findBoundaryEventsForFlowNode

      protected Collection<org.activiti.bpmn.model.BoundaryEvent> findBoundaryEventsForFlowNode(String processDefinitionId, org.activiti.bpmn.model.FlowElement flowElement)
    • getProcessDefinition

      protected org.activiti.bpmn.model.Process getProcessDefinition(String processDefinitionId)
    • trigger

      public void trigger(DelegateExecution execution, String signalName, Object signalData)
      Specified by:
      trigger in interface TriggerableActivityBehavior
      Overrides:
      trigger in class FlowNodeActivityBehavior
    • lastExecutionEnded

      public void lastExecutionEnded(DelegateExecution execution)
    • 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 interface SubProcessActivityBehavior
      Throws:
      Exception
    • completed

      public void completed(DelegateExecution execution) throws Exception
      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 interface SubProcessActivityBehavior
      Throws:
      Exception
    • resolveNrOfInstances

      protected int resolveNrOfInstances(DelegateExecution execution)
    • executeOriginalBehavior

      protected void executeOriginalBehavior(DelegateExecution execution, int loopCounter)
    • resolveAndValidateCollection

      protected Collection resolveAndValidateCollection(DelegateExecution execution)
    • resolveCollection

      protected 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, String variableName, Object value)
    • getLoopVariable

      protected Integer getLoopVariable(DelegateExecution execution, String variableName)
    • getLocalLoopVariable

      protected Integer getLocalLoopVariable(DelegateExecution execution, String variableName)
    • removeLocalLoopVariable

      protected void removeLocalLoopVariable(DelegateExecution execution, 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, 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 String getCollectionVariable()
    • setCollectionVariable

      public void setCollectionVariable(String collectionVariable)
    • getCollectionElementVariable

      public String getCollectionElementVariable()
    • setCollectionElementVariable

      public void setCollectionElementVariable(String collectionElementVariable)
    • getCollectionElementIndexVariable

      public String getCollectionElementIndexVariable()
    • setCollectionElementIndexVariable

      public void setCollectionElementIndexVariable(String collectionElementIndexVariable)
    • setInnerActivityBehavior

      public void setInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)
    • getInnerActivityBehavior

      public AbstractBpmnActivityBehavior getInnerActivityBehavior()
    • getLoopDataOutputRef

      public String getLoopDataOutputRef()
    • hasLoopDataOutputRef

      public boolean hasLoopDataOutputRef()
    • setLoopDataOutputRef

      public void setLoopDataOutputRef(String loopDataOutputRef)
    • getOutputDataItem

      public String getOutputDataItem()
    • hasOutputDataItem

      public boolean hasOutputDataItem()
    • setOutputDataItem

      public void setOutputDataItem(String outputDataItem)
    • updateResultCollection

      protected void updateResultCollection(DelegateExecution childExecution, DelegateExecution miRootExecution)
    • getResultElementItem

      protected Object getResultElementItem(DelegateExecution childExecution)
    • getCommandContext

      protected CommandContext getCommandContext()
    • getResultElementItem

      protected Object getResultElementItem(Map<String,Object> availableVariables)
    • propagateLoopDataOutputRefToProcessInstance

      protected void propagateLoopDataOutputRefToProcessInstance(ExecutionEntity miRootExecution)