Java Code Examples for org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior#setCollectionVariable()
The following examples show how to use
org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior#setCollectionVariable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractActivityBpmnParseHandler.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) { MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics(); // Activity Behavior MultiInstanceActivityBehavior miActivityBehavior = null; if (loopCharacteristics.isSequential()) { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior(modelActivity, (AbstractBpmnActivityBehavior) modelActivity.getBehavior()); } else { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior(modelActivity, (AbstractBpmnActivityBehavior) modelActivity.getBehavior()); } modelActivity.setBehavior(miActivityBehavior); ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); // loop cardinality if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) { miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality())); } // completion condition if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) { miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition())); } // activiti:collection if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) { if (loopCharacteristics.getInputDataItem().contains("{")) { miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem())); } else { miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem()); } } // activiti:elementVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementVariable())) { miActivityBehavior.setCollectionElementVariable(loopCharacteristics.getElementVariable()); } // activiti:elementIndexVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementIndexVariable())) { miActivityBehavior.setCollectionElementIndexVariable(loopCharacteristics.getElementIndexVariable()); } }
Example 2
Source File: AbstractActivityBpmnParseHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) { MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics(); // Activity Behavior MultiInstanceActivityBehavior miActivityBehavior = null; ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId()); if (activity == null) { throw new ActivitiException("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found"); } if (loopCharacteristics.isSequential()) { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior( activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior()); } else { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior( activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior()); } // ActivityImpl settings activity.setScope(true); activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel"); activity.setActivityBehavior(miActivityBehavior); ExpressionManager expressionManager = bpmnParse.getExpressionManager(); // loop cardinality if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) { miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality())); } // completion condition if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) { miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition())); } // activiti:collection if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) { if (loopCharacteristics.getInputDataItem().contains("{")) { miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem())); } else { miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem()); } } // activiti:elementVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementVariable())) { miActivityBehavior.setCollectionElementVariable(loopCharacteristics.getElementVariable()); } // activiti:elementIndexVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementIndexVariable())) { miActivityBehavior.setCollectionElementIndexVariable(loopCharacteristics.getElementIndexVariable()); } }