org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior Java Examples
The following examples show how to use
org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.
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: EndExecutionOperation.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected void handleMultiInstanceSubProcess(ExecutionEntityManager executionEntityManager, ExecutionEntity parentExecution) { List<ExecutionEntity> activeChildExecutions = getActiveChildExecutionsForExecution(executionEntityManager, parentExecution.getId()); boolean containsOtherChildExecutions = false; for (ExecutionEntity activeExecution : activeChildExecutions) { if (activeExecution.getId().equals(execution.getId()) == false) { containsOtherChildExecutions = true; } } if (!containsOtherChildExecutions) { // Destroy the current scope (subprocess) and leave via the subprocess ScopeUtil.createCopyOfSubProcessExecutionForCompensation(parentExecution); Context.getAgenda().planDestroyScopeOperation(parentExecution); SubProcess subProcess = execution.getCurrentFlowElement().getSubProcess(); MultiInstanceActivityBehavior multiInstanceBehavior = (MultiInstanceActivityBehavior) subProcess.getBehavior(); parentExecution.setCurrentFlowElement(subProcess); multiInstanceBehavior.leave(parentExecution); } }
Example #2
Source File: ActivitiTypeConverter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public String getFormKey(PvmActivity act, ReadOnlyProcessDefinition processDefinition) { if(act instanceof ActivityImpl) { ActivityImpl actImpl = (ActivityImpl) act; if (actImpl.getActivityBehavior() instanceof UserTaskActivityBehavior) { UserTaskActivityBehavior uta = (UserTaskActivityBehavior) actImpl.getActivityBehavior(); return getFormKey(uta.getTaskDefinition()); } else if(actImpl.getActivityBehavior() instanceof MultiInstanceActivityBehavior) { // Get the task-definition from the process-definition if(processDefinition instanceof ProcessDefinitionEntity) { // Task definition id is the same the the activity id TaskDefinition taskDef = ((ProcessDefinitionEntity) processDefinition).getTaskDefinitions().get(act.getId()); if(taskDef != null) { return getFormKey(taskDef); } } } } return null; }
Example #3
Source File: AlfrescoUserTaskBpmnParseHandler.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
protected void executeParse(BpmnParse bpmnParse, UserTask userTask) { ActivityImpl activity = findActivity(bpmnParse, userTask.getId()); ActivityBehavior activitybehaviour = activity.getActivityBehavior(); if (activitybehaviour instanceof UserTaskActivityBehavior) { addListeners((UserTaskActivityBehavior) activity.getActivityBehavior()); } else if(activitybehaviour instanceof MultiInstanceActivityBehavior) { MultiInstanceActivityBehavior multiInstance = (MultiInstanceActivityBehavior) activitybehaviour; if(multiInstance.getInnerActivityBehavior() instanceof UserTaskActivityBehavior) { addListeners((UserTaskActivityBehavior) multiInstance.getInnerActivityBehavior()); } } }
Example #4
Source File: EndExecutionOperation.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected boolean isEndEventInMultiInstanceSubprocess(ExecutionEntity executionEntity) { if (executionEntity.getCurrentFlowElement() instanceof EndEvent) { SubProcess subProcess = ((EndEvent) execution.getCurrentFlowElement()).getSubProcess(); return !executionEntity.getParent().isProcessInstanceType() && subProcess != null && subProcess.getLoopCharacteristics() != null && subProcess.getBehavior() instanceof MultiInstanceActivityBehavior; } return false; }
Example #5
Source File: MultiInstanceActivityCreator.java From openwebflow with BSD 2-Clause "Simplified" License | 5 votes |
private ActivityImpl createMultiInstanceActivity(ProcessEngine processEngine, ProcessDefinitionEntity processDefinition, String processInstanceId, String prototypeActivityId, String cloneActivityId, boolean isSequential, List<String> assignees) { ActivityImpl prototypeActivity = ProcessDefinitionUtils.getActivity(processEngine, processDefinition.getId(), prototypeActivityId); //拷贝listener,executionListeners会激活历史记录的保存 ActivityImpl clone = cloneActivity(processDefinition, prototypeActivity, cloneActivityId, "executionListeners", "properties"); //拷贝所有后向链接 for (PvmTransition trans : prototypeActivity.getOutgoingTransitions()) { clone.createOutgoingTransition(trans.getId()).setDestination((ActivityImpl) trans.getDestination()); } MultiInstanceActivityBehavior multiInstanceBehavior = isSequential ? new SequentialMultiInstanceBehavior(clone, (TaskActivityBehavior) prototypeActivity.getActivityBehavior()) : new ParallelMultiInstanceBehavior( clone, (TaskActivityBehavior) prototypeActivity.getActivityBehavior()); clone.setActivityBehavior(multiInstanceBehavior); clone.setScope(true); clone.setProperty("multiInstance", isSequential ? "sequential" : "parallel"); //设置多实例节点属性 multiInstanceBehavior.setLoopCardinalityExpression(new FixedValue(assignees.size())); multiInstanceBehavior.setCollectionExpression(new FixedValue(assignees)); return clone; }
Example #6
Source File: CustomUserTaskActivityBehavior.java From lemon with Apache License 2.0 | 5 votes |
public void setMultiInstanceActivityBehavior( MultiInstanceActivityBehavior multiInstanceActivityBehavior) { // TODO Auto-generated method stub log.info("MultiInstance usertask -- {}", multiInstanceActivityBehavior); super.setMultiInstanceActivityBehavior(multiInstanceActivityBehavior); log.info("jdbcTemplate : {}", jdbcTemplate); }
Example #7
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 #8
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()); } }