private List<FlowNode> flowNodes = null;
/**
* 获取并行网关内的任务节点
*/
private void getParallelGatewayInsideNode() {
List<FlowElement> flowElements = (List<FlowElement>)bpmnModel.getMainProcess().getFlowElements();
FlowNode currFlowNode = null;
flowNodes = new ArrayList<>();
// 找到流程中第一个并行网关
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof ParallelGateway) {
currFlowNode = (FlowNode)flowElement;
break;
}
}
if (currFlowNode != null) {
List<SequenceFlow> outgoingFlows = currFlowNode.getOutgoingFlows();
getForwardNodeList(outgoingFlows);
}
}
private void getForwardNodeList(List<SequenceFlow> outgoingFlows) {
for (SequenceFlow sequenceFlow : outgoingFlows) {
String targetNodeId = sequenceFlow.getTargetRef();
FlowNode targetNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(targetNodeId);
String gatewayType = targetNodeId.substring(targetNodeId
.lastIndexOf("_") + 1);
// 并行网关必须成对出现,配置的id必须以_start、_end结尾
if (targetNode instanceof ParallelGateway && "END".equals(gatewayType.toUpperCase())) {
continue;
}
if (targetNode instanceof UserTask && !flowNodes.contains(targetNode)) {
flowNodes.add(targetNode);
}
getForwardNodeList(targetNode.getOutgoingFlows());
}
}
springboot+activiti7获取并行网关、包含网关内的任务节点
最新推荐文章于 2024-06-17 13:17:31 发布