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