activiti的 GateWay类org\activiti\activiti-bpmn-model\7.1.0.M6\activiti-bpmn-model-7.1.0.M6.jar!\org\activiti\bpmn\model\Gateway.class 有4个子类
ExclusiveGateway 排他网关 ComplexGateway混合/复杂网关 InclusiveGateway包容网关 ParallelGateway并行网关 他们结构是一样的 每个都有自己的behiver 区别在处理类如何处理上
org\activiti\activiti-bpmn-model\7.1.0.M6\activiti-bpmn-model-7.1.0.M6.jar!\org\activiti\bpmn\model\InclusiveGateway.class
org\activiti\activiti-bpmn-model\7.1.0.M6\activiti-bpmn-model-7.1.0.M6.jar!\org\activiti\bpmn\model\ComplexGateway.class
org\activiti\activiti-bpmn-model\7.1.0.M6\activiti-bpmn-model-7.1.0.M6.jar!\org\activiti\bpmn\model\ParallelGateway.class
排他网关处理类
\org\activiti\activiti-engine\7.1.0.M6\activiti-engine-7.1.0.M6.jar!\org\activiti\engine\impl\bpmn\behavior\ExclusiveGatewayActivityBehavior.class
一些关键代码
String defaultSequenceFlowId = exclusiveGateway.getDefaultFlow(); //获取所有输出线 Iterator sequenceFlowIterator = exclusiveGateway.getOutgoingFlows().iterator(); while(outgoingSequenceFlow == null && sequenceFlowIterator.hasNext()) { SequenceFlow sequenceFlow = (SequenceFlow)sequenceFlowIterator.next(); String skipExpressionString = sequenceFlow.getSkipExpression(); if (!SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpressionString)) { //调用方法 判断 这个线上的 条件和 当前流程只 是否满足 boolean conditionEvaluatesToTrue = ConditionUtil.hasTrueCondition(sequenceFlow, execution); if (conditionEvaluatesToTrue && (defaultSequenceFlowId == null || !defaultSequenceFlowId.equals(sequenceFlow.getId()))) { if (log.isDebugEnabled()) { log.debug("Sequence flow '{}'selected as outgoing sequence flow.", sequenceFlow.getId()); } outgoingSequenceFlow = sequenceFlow; } } else if (SkipExpressionUtil.shouldSkipFlowElement(Context.getCommandContext(), execution, skipExpressionString)) { outgoingSequenceFlow = sequenceFlow; } if (defaultSequenceFlowId != null && defaultSequenceFlowId.equals(sequenceFlow.getId())) { defaultSequenceFlow = sequenceFlow; } }
ConditionUtil.hasTrueCondition 跳进去继续看
拿到 uel表达式 去执行判断 我们如果要手动判断经过网关后流程向哪儿走 可以参考或者调用这些逻辑