Class MultiInstanceActivityBehavior

java.lang.Object
org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
org.flowable.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior
All Implemented Interfaces:
Serializable, ActivityBehavior, InterruptibleActivityBehaviour, SubProcessActivityBehavior, TriggerableActivityBehavior
Direct Known Subclasses:
ParallelMultiInstanceBehavior, SequentialMultiInstanceBehavior

public abstract class MultiInstanceActivityBehavior extends FlowNodeActivityBehavior implements SubProcessActivityBehavior, InterruptibleActivityBehaviour
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.
Author:
Joram Barrez, Tijs Rademakers, Filip Hrisafov
See Also:
  • Field Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • DELETE_REASON_END

      protected static final String DELETE_REASON_END
      See Also:
    • NUMBER_OF_INSTANCES

      protected static final String NUMBER_OF_INSTANCES
      See Also:
    • NUMBER_OF_ACTIVE_INSTANCES

      protected static final String NUMBER_OF_ACTIVE_INSTANCES
      See Also:
    • NUMBER_OF_COMPLETED_INSTANCES

      protected static final String NUMBER_OF_COMPLETED_INSTANCES
      See Also:
    • activity

      protected org.flowable.bpmn.model.Activity activity
    • innerActivityBehavior

      protected AbstractBpmnActivityBehavior innerActivityBehavior
    • loopCardinalityExpression

      protected Expression loopCardinalityExpression
    • completionCondition

      protected String completionCondition
    • collectionExpression

      protected Expression collectionExpression
    • collectionVariable

      protected String collectionVariable
    • collectionElementVariable

      protected String collectionElementVariable
    • collectionString

      protected String collectionString
    • collectionHandler

      protected org.flowable.bpmn.model.CollectionHandler collectionHandler
    • aggregations

      protected org.flowable.bpmn.model.VariableAggregationDefinitions aggregations
    • collectionElementIndexVariable

      protected String collectionElementIndexVariable
  • Constructor Details

    • MultiInstanceActivityBehavior

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

    • execute

      public void execute(DelegateExecution delegateExecution)
      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)
    • leave

      public void leave(DelegateExecution execution)
      Description copied from class: FlowNodeActivityBehavior
      Default way of leaving a BPMN 2.0 activity: evaluate the conditions on the outgoing sequence flow and take those that evaluate to true.
      Overrides:
      leave in class FlowNodeActivityBehavior
    • hasVariableAggregationDefinitions

      protected boolean hasVariableAggregationDefinitions(DelegateExecution execution)
    • aggregateVariablesForChildExecution

      protected void aggregateVariablesForChildExecution(DelegateExecution childExecution, DelegateExecution miRootExecution)
      Aggregated the variables for the finished child multi instance execution
      Parameters:
      childExecution - the child execution
      miRootExecution - the multi instance root execution
    • aggregateVariablesOfAllInstances

      protected void aggregateVariablesOfAllInstances(DelegateExecution multiInstanceRootExecution)
      Aggregates all variables that were stored before for each child instance
    • cleanupMiRoot

      protected void cleanupMiRoot(DelegateExecution execution)
    • executeCompensationBoundaryEvents

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

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

      protected org.flowable.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
    • interrupted

      public void interrupted(DelegateExecution execution)
      Specified by:
      interrupted in interface InterruptibleActivityBehaviour
    • internalInterrupted

      protected void internalInterrupted(DelegateExecution execution)
    • completionConditionSatisfied

      public boolean completionConditionSatisfied(DelegateExecution execution)
    • getLoopVariable

      public Integer getLoopVariable(DelegateExecution execution, String variableName)
    • getLoopVariableInstance

      public org.flowable.variable.api.persistence.entity.VariableInstance getLoopVariableInstance(DelegateExecution execution, String variableName)
    • sendCompletedWithConditionEvent

      protected void sendCompletedWithConditionEvent(DelegateExecution execution)
    • sendCompletedEvent

      protected void sendCompletedEvent(DelegateExecution execution)
    • buildCompletedEvent

      protected FlowableMultiInstanceActivityCompletedEvent buildCompletedEvent(DelegateExecution execution, FlowableEngineEventType eventType)
    • resolveNrOfInstances

      protected int resolveNrOfInstances(DelegateExecution execution)
    • executeOriginalBehavior

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

      protected Collection resolveAndValidateCollection(DelegateExecution execution)
    • iterableToCollection

      protected Collection iterableToCollection(Iterable iterable)
    • resolveCollection

      protected Object resolveCollection(DelegateExecution execution)
    • usesCollection

      protected boolean usesCollection()
    • isExtraScopeNeeded

      protected boolean isExtraScopeNeeded(org.flowable.bpmn.model.FlowNode flowNode)
    • resolveLoopCardinality

      protected int resolveLoopCardinality(DelegateExecution execution)
    • setLoopVariable

      protected void setLoopVariable(DelegateExecution execution, String variableName, Object value)
    • getLocalLoopVariable

      protected Integer getLocalLoopVariable(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 execution)
    • getInstanceExecution

      protected DelegateExecution getInstanceExecution(DelegateExecution execution)
    • getActiveValue

      protected String getActiveValue(String originalValue, String propertyName, com.fasterxml.jackson.databind.node.ObjectNode taskElementProperties)
    • createFlowableCollectionHandler

      protected FlowableCollectionHandler createFlowableCollectionHandler(org.flowable.bpmn.model.CollectionHandler handler, DelegateExecution execution)
    • getLoopCardinalityExpression

      public Expression getLoopCardinalityExpression()
    • setLoopCardinalityExpression

      public void setLoopCardinalityExpression(Expression loopCardinalityExpression)
    • getCompletionCondition

      public String getCompletionCondition()
    • setCompletionCondition

      public void setCompletionCondition(String completionCondition)
    • 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)
    • getCollectionString

      public String getCollectionString()
    • setCollectionString

      public void setCollectionString(String collectionString)
    • getHandler

      public org.flowable.bpmn.model.CollectionHandler getHandler()
    • setHandler

      public void setHandler(org.flowable.bpmn.model.CollectionHandler collectionHandler)
    • getAggregations

      public org.flowable.bpmn.model.VariableAggregationDefinitions getAggregations()
    • setAggregations

      public void setAggregations(org.flowable.bpmn.model.VariableAggregationDefinitions aggregations)
    • getCollectionElementIndexVariable

      public String getCollectionElementIndexVariable()
    • setCollectionElementIndexVariable

      public void setCollectionElementIndexVariable(String collectionElementIndexVariable)
    • setInnerActivityBehavior

      public void setInnerActivityBehavior(AbstractBpmnActivityBehavior innerActivityBehavior)
    • getInnerActivityBehavior

      public AbstractBpmnActivityBehavior getInnerActivityBehavior()