浏览代码

fix: 优化流程5

liuc 2 月之前
父节点
当前提交
636f9d53ba

二进制
bound-link-api/sa-flow-api/src/main/resources/lib/sa-flow-engine-3.0.0.jar


+ 25 - 0
bound-link-api/sa-flow-common/src/main/java/com/cloud/sa/flow/commom/domain/virenum/ActionType.java

@@ -1,6 +1,10 @@
 package com.cloud.sa.flow.commom.domain.virenum;
 
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * 节点类型
  */
@@ -55,5 +59,26 @@ public enum ActionType {
     public String getInfo() {
         return info;
     }
+    private static final Map<String, ActionType> CODE_MAP;
+
+    static {
+        Map<String, ActionType> map = new HashMap<>();
+        for (ActionType type : ActionType.values()) {
+            map.put(type.code, type);
+        }
+        CODE_MAP = Collections.unmodifiableMap(map);
+    }
+
+    public static ActionType ofCode(String code) {
+        return CODE_MAP.get(code);
+    }
+
+    public static ActionType ofCodeOrThrow(String code) {
+        ActionType type = CODE_MAP.get(code);
+        if (type == null) {
+            throw new IllegalArgumentException("Unknown ActionType code: " + code);
+        }
+        return type;
+    }
 
 }