mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-24 00:58:10 +08:00
修复在多个flow.xml配置的时候,条件节点会出错的bug
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user