springboot+activiti7获取并行网关、包含网关内的任务节点
private List<FlowNode> flowNodes = null;/*** 获取并行网关内的任务节点*/private void getParallelGatewayInsideNode() {List<FlowElement> flowElements = (List<FlowElement>)bpmnModel.getMainProcess()
·
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());
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)