modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
/**
   * Parses loopCharacteristics (standardLoop/Multi-instance) of an activity, if
   * any is defined.
   */
Parses loopCharacteristics (standardLoop/Multi-instance) of an activity, if
any is defined.
Parses loopCharacteristics ( standardLoop / Multi - instance ) of an activity if any is defined .
public void createMultiInstanceLoopCharacteristics(org.activiti.bpmn.model.Activity modelActivity, ActivityImpl activity) {
    MultiInstanceActivityBehavior miActivityBehavior = null;
    MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
    if (loopCharacteristics == null) {
      return;
    }
    if (loopCharacteristics.isSequential()) {
      miActivityBehavior = activityBehaviorFactory.createSequentialMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior()); 
    } else {
      miActivityBehavior = activityBehaviorFactory.createParallelMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior());
    }
    activity.setScope(true);
    activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel");
    activity.setActivityBehavior(miActivityBehavior);
    if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) {
      miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality()));
    }
    if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) {
      miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition()));
    }
    if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) {
      if (loopCharacteristics.getInputDataItem().contains("{")) {
        miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem()));
      } else {
        miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem());
      }
    }
    if (StringUtils.isNotEmpty(loopCharacteristics.getElementVariable())) {
      miActivityBehavior.setCollectionElementVariable(loopCharacteristics.getElementVariable());
    }
    if (miActivityBehavior.getLoopCardinalityExpression() == null && miActivityBehavior.getCollectionExpression() == null
            && miActivityBehavior.getCollectionVariable() == null) {
      bpmnModel.addProblem("Either loopCardinality or loopDataInputRef/activiti:collection must been set.", loopCharacteristics);
    }
    if (miActivityBehavior.getCollectionExpression() == null && miActivityBehavior.getCollectionVariable() == null
            && miActivityBehavior.getCollectionElementVariable() != null) {
      bpmnModel.addProblem("LoopDataInputRef/activiti:collection must be set when using inputDataItem or activiti:elementVariable.", loopCharacteristics);
    }
    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseMultiInstanceLoopCharacteristics(modelActivity, loopCharacteristics, activity);
    }
  }
public void createMultiInstanceLoopCharacteristics ( org . activiti . bpmn . model . Activity modelActivity , ActivityImpl activity ) { MultiInstanceActivityBehavior miActivityBehavior = null ; MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity . getLoopCharacteristics ( ) ; if ( loopCharacteristics == null ) { return ; } if ( loopCharacteristics . isSequential ( ) ) { miActivityBehavior = activityBehaviorFactory . createSequentialMultiInstanceBehavior ( activity , ( AbstractBpmnActivityBehavior ) activity . getActivityBehavior ( ) ) ; } else { miActivityBehavior = activityBehaviorFactory . createParallelMultiInstanceBehavior ( activity , ( AbstractBpmnActivityBehavior ) activity . getActivityBehavior ( ) ) ; } activity . setScope ( true ) ; activity . setProperty ( "multiInstance" , loopCharacteristics . isSequential ( ) ? "sequential" : "parallel" ) ; activity . setActivityBehavior ( miActivityBehavior ) ; if ( StringUtils . isNotEmpty ( loopCharacteristics . getLoopCardinality ( ) ) ) { miActivityBehavior . setLoopCardinalityExpression ( expressionManager . createExpression ( loopCharacteristics . getLoopCardinality ( ) ) ) ; } if ( StringUtils . isNotEmpty ( loopCharacteristics . getCompletionCondition ( ) ) ) { miActivityBehavior . setCompletionConditionExpression ( expressionManager . createExpression ( loopCharacteristics . getCompletionCondition ( ) ) ) ; } if ( StringUtils . isNotEmpty ( loopCharacteristics . getInputDataItem ( ) ) ) { if ( loopCharacteristics . getInputDataItem ( ) . contains ( "{" ) ) { miActivityBehavior . setCollectionExpression ( expressionManager . createExpression ( loopCharacteristics . getInputDataItem ( ) ) ) ; } else { miActivityBehavior . setCollectionVariable ( loopCharacteristics . getInputDataItem ( ) ) ; } } if ( StringUtils . isNotEmpty ( loopCharacteristics . getElementVariable ( ) ) ) { miActivityBehavior . setCollectionElementVariable ( loopCharacteristics . getElementVariable ( ) ) ; } if ( miActivityBehavior . getLoopCardinalityExpression ( ) == null && miActivityBehavior . getCollectionExpression ( ) == null && miActivityBehavior . getCollectionVariable ( ) == null ) { bpmnModel . addProblem ( "Either loopCardinality or loopDataInputRef/activiti:collection must been set." , loopCharacteristics ) ; } if ( miActivityBehavior . getCollectionExpression ( ) == null && miActivityBehavior . getCollectionVariable ( ) == null && miActivityBehavior . getCollectionElementVariable ( ) != null ) { bpmnModel . addProblem ( "LoopDataInputRef/activiti:collection must be set when using inputDataItem or activiti:elementVariable." , loopCharacteristics ) ; } for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseMultiInstanceLoopCharacteristics ( modelActivity , loopCharacteristics , activity ) ; } }
Parses loopCharacteristics (standardLoop/Multi-instance) of an activity, if
 any is defined.
Parses loopCharacteristics ( standardLoop / Multi - instance ) of an activity if any is defined .
// nothing to do // Activity Behavior // ActivityImpl settings // loopcardinality // completion condition // activiti:collection // activiti:elementVariable // Validation // Validation