Procházet zdrojové kódy

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

bryan.zhang před 5 roky
rodič
revize
82e26527d9

+ 1 - 1
liteflow-core/pom.xml

@@ -9,7 +9,7 @@
     <parent>
 		<groupId>com.yomahub</groupId>
 		<artifactId>liteflow</artifactId>
-		<version>2.2.1</version>
+		<version>2.2.2</version>
 	</parent>
 
 	<dependencies>

+ 6 - 8
liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java

@@ -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);
 	}
 

+ 3 - 1
liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java

@@ -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()));
+					}
 				}
 			}
 

+ 1 - 1
liteflow-spring-boot-starter/pom.xml

@@ -10,7 +10,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.2.1</version>
+        <version>2.2.2</version>
     </parent>
 
     <dependencies>

+ 1 - 1
liteflow-test-spring/pom.xml

@@ -9,7 +9,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.2.1</version>
+        <version>2.2.2</version>
     </parent>
 
     <dependencies>

+ 1 - 1
liteflow-test-springboot/pom.xml

@@ -9,7 +9,7 @@
     <parent>
         <artifactId>liteflow</artifactId>
         <groupId>com.yomahub</groupId>
-        <version>2.2.1</version>
+        <version>2.2.2</version>
     </parent>
 
     <dependencyManagement>

+ 1 - 1
pom.xml

@@ -5,7 +5,7 @@
 	<groupId>com.yomahub</groupId>
     <artifactId>liteflow</artifactId>
     <packaging>pom</packaging>
-    <version>2.2.1</version>
+    <version>2.2.2</version>
 	<name>liteflow</name>
 	<description>a lightweight and practical micro-process framework</description>
 	<url>https://github.com/bryan31/liteflow</url>