修复在多个flow.xml配置的时候,条件节点会出错的bug

This commit is contained in:
bryan.zhang
2020-03-29 17:52:02 +08:00
parent 1f7e5fd12a
commit 82e26527d9
7 changed files with 14 additions and 14 deletions

View File

@@ -19,9 +19,9 @@ import com.yomahub.liteflow.entity.config.Node;
public class FlowBus {
private static Map<String, Chain> chainMap;
private static Map<String, Chain> chainMap = new HashMap<>();
private static Map<String, Node> nodeMap;
private static Map<String, Node> nodeMap = new HashMap<>();
public static Chain getChain(String id) throws Exception{
if(chainMap == null || chainMap.isEmpty()){
@@ -31,9 +31,6 @@ public class FlowBus {
}
public static void addChain(String name,Chain chain){
if(chainMap == null){
chainMap = new HashMap<>();
}
chainMap.put(name, chain);
}
@@ -41,10 +38,11 @@ public class FlowBus {
return MapUtils.isEmpty(chainMap);
}
public static boolean containNode(String nodeId){
return nodeMap.containsKey(nodeId);
}
public static void addNode(String nodeId, Node node) {
if(nodeMap == null) {
nodeMap = new HashMap<>();
}
nodeMap.put(nodeId, node);
}

View File

@@ -63,7 +63,9 @@ public abstract class XmlFlowParser {
}
}else{
for(Entry<String, NodeComponent> componentEntry : ComponentScaner.nodeComponentMap.entrySet()){
FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue()));
if(!FlowBus.containNode(componentEntry.getKey())){
FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue()));
}
}
}