From 5c333955f84d08b3799262dae40df324b15336aa Mon Sep 17 00:00:00 2001
From: "1437892690@qq.com" <1437892690@qq.com>
Date: Mon, 1 Jul 2024 20:26:55 +0800
Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E5=90=8E=E7=AB=AF-?=
=?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=88=A0=E9=99=A4=E8=8A=82=E7=82=B9=EF=BC=8C?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=99=E4=B8=AA?=
=?UTF-8?q?=E8=8A=82=E7=82=B9=E8=BF=98=E6=98=AF=E5=AD=98=E5=9C=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
关联 #[1166498725330944]流程删除节点,保存的数据这个节点还是存在 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1166498725330944
---
.../process/dto/ProcessStepRelVo.java | 21 +++
.../framework/process/dto/ProcessVo.java | 21 ++-
.../process/ProcessConfigException.java | 47 +++++
.../core/ProcessMessageContext.java | 65 +++++++
.../core/ProcessMessageManager.java | 175 ++++++++++++++++++
.../process/util/ProcessConfigUtil.java | 102 +++++-----
6 files changed, 375 insertions(+), 56 deletions(-)
create mode 100644 src/main/java/neatlogic/framework/process/exception/process/ProcessConfigException.java
create mode 100644 src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageContext.java
create mode 100644 src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageManager.java
diff --git a/src/main/java/neatlogic/framework/process/dto/ProcessStepRelVo.java b/src/main/java/neatlogic/framework/process/dto/ProcessStepRelVo.java
index 4d713cee..0ac05891 100755
--- a/src/main/java/neatlogic/framework/process/dto/ProcessStepRelVo.java
+++ b/src/main/java/neatlogic/framework/process/dto/ProcessStepRelVo.java
@@ -1,5 +1,8 @@
package neatlogic.framework.process.dto;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.annotation.JSONField;
+
import java.io.Serializable;
public class ProcessStepRelVo implements Serializable {
@@ -8,7 +11,11 @@ public class ProcessStepRelVo implements Serializable {
private String uuid;
private String fromStepUuid;
private String toStepUuid;
+ @JSONField(serialize = false)
private String condition;
+
+ private JSONObject conditionConfig;
+
private String name;
private String type;
@Override
@@ -62,6 +69,9 @@ public class ProcessStepRelVo implements Serializable {
}
public String getCondition() {
+ if (condition == null && conditionConfig != null) {
+ condition = conditionConfig.toJSONString();
+ }
return condition;
}
@@ -69,6 +79,17 @@ public class ProcessStepRelVo implements Serializable {
this.condition = condition;
}
+ public JSONObject getConditionConfig() {
+ if (conditionConfig == null && condition != null) {
+ conditionConfig = JSONObject.parseObject(condition);
+ }
+ return conditionConfig;
+ }
+
+ public void setConditionConfig(JSONObject conditionConfig) {
+ this.conditionConfig = conditionConfig;
+ }
+
public String getProcessUuid() {
return processUuid;
}
diff --git a/src/main/java/neatlogic/framework/process/dto/ProcessVo.java b/src/main/java/neatlogic/framework/process/dto/ProcessVo.java
index 207cc724..cd70626a 100644
--- a/src/main/java/neatlogic/framework/process/dto/ProcessVo.java
+++ b/src/main/java/neatlogic/framework/process/dto/ProcessVo.java
@@ -262,9 +262,10 @@ public class ProcessVo extends BaseEditorVo {
if (relList != null && relList.size() > 0) {
this.stepRelList = new ArrayList<>();
for (int i = 0; i < relList.size(); i++) {
- JSONObject relObj = relList.getJSONObject(i);
- String fromStepUuid = relObj.getString("fromStepUuid");
- String toStepUuid = relObj.getString("toStepUuid");
+ ProcessStepRelVo processStepRelVo = relList.getObject(i, ProcessStepRelVo.class);
+// JSONObject relObj = relList.getJSONObject(i);
+ String fromStepUuid = processStepRelVo.getFromStepUuid();
+ String toStepUuid = processStepRelVo.getToStepUuid();
if (virtualStartStepUuid.equals(fromStepUuid)) {// 通过虚拟开始节点连线找到真正的开始步骤
ProcessStepVo startStep = stepMap.get(toStepUuid);
if (startStep != null) {
@@ -272,14 +273,14 @@ public class ProcessVo extends BaseEditorVo {
}
continue;
}
- ProcessStepRelVo processStepRelVo = new ProcessStepRelVo();
- processStepRelVo.setFromStepUuid(fromStepUuid);
- processStepRelVo.setToStepUuid(toStepUuid);
- processStepRelVo.setUuid(relObj.getString("uuid"));
+// ProcessStepRelVo processStepRelVo = new ProcessStepRelVo();
+// processStepRelVo.setFromStepUuid(fromStepUuid);
+// processStepRelVo.setToStepUuid(toStepUuid);
+// processStepRelVo.setUuid(relObj.getString("uuid"));
processStepRelVo.setProcessUuid(this.getUuid());
- processStepRelVo.setCondition(relObj.getString("conditionConfig"));
- processStepRelVo.setName(relObj.getString("name"));
- String type = relObj.getString("type");
+// processStepRelVo.setCondition(relObj.getString("conditionConfig"));
+// processStepRelVo.setName(relObj.getString("name"));
+ String type = processStepRelVo.getType();
if (!ProcessFlowDirection.BACKWARD.getValue().equals(type)) {
type = ProcessFlowDirection.FORWARD.getValue();
}
diff --git a/src/main/java/neatlogic/framework/process/exception/process/ProcessConfigException.java b/src/main/java/neatlogic/framework/process/exception/process/ProcessConfigException.java
new file mode 100644
index 00000000..546058cd
--- /dev/null
+++ b/src/main/java/neatlogic/framework/process/exception/process/ProcessConfigException.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.process.exception.process;
+
+import neatlogic.framework.exception.core.ApiRuntimeException;
+import neatlogic.framework.util.$;
+
+public class ProcessConfigException extends ApiRuntimeException {
+
+ public enum Type {
+ SLA, CONDITION, COPY, PRE_STEP_ASSIGN, PRE_STEP_ASSIGN_CONDITION_STEP
+ }
+
+ public ProcessConfigException(Type type, String name) {
+ super(getMessage(type, name));
+ }
+
+ private static String getMessage(Type type, String name) {
+ if (type == Type.SLA) {
+ return $.t("nfpep.processconfigexception.sla", name);
+ } else if (type == Type.CONDITION) {
+ return $.t("nfpep.processconfigexception.condition", name);
+ } else if (type == Type.COPY) {
+ return $.t("nfpep.processconfigexception.copy", name);
+ } else if (type == Type.PRE_STEP_ASSIGN) {
+ return $.t("nfpep.processconfigexception.prestepassign", name);
+ } else if (type == Type.PRE_STEP_ASSIGN_CONDITION_STEP) {
+ return $.t("nfpep.processconfigexception.prestepassignconditionstep", name);
+ }
+ return "";
+ }
+}
diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageContext.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageContext.java
new file mode 100644
index 00000000..cabc3917
--- /dev/null
+++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageContext.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.process.stephandler.core;
+
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.process.dto.ProcessStepRelVo;
+
+import java.util.List;
+
+public class ProcessMessageContext {
+
+ private final JSONObject config;
+
+ private String stepName;
+ private List effectiveStepUuidList;
+
+ private List connectionList;
+
+ public ProcessMessageContext(JSONObject config) {
+ this.config = config;
+ }
+
+ public JSONObject getConfig() {
+ return config;
+ }
+
+ public String getStepName() {
+ return stepName;
+ }
+
+ public void setStepName(String stepName) {
+ this.stepName = stepName;
+ }
+
+ public List getEffectiveStepUuidList() {
+ return effectiveStepUuidList;
+ }
+
+ public void setEffectiveStepUuidList(List effectiveStepUuidList) {
+ this.effectiveStepUuidList = effectiveStepUuidList;
+ }
+
+ public List getConnectionList() {
+ return connectionList;
+ }
+
+ public void setConnectionList(List connectionList) {
+ this.connectionList = connectionList;
+ }
+}
diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageManager.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageManager.java
new file mode 100644
index 00000000..46d5234a
--- /dev/null
+++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessMessageManager.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package neatlogic.framework.process.stephandler.core;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.process.constvalue.ProcessFlowDirection;
+import neatlogic.framework.process.constvalue.ProcessStepHandlerType;
+import neatlogic.framework.process.dto.ProcessStepRelVo;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class ProcessMessageManager {
+ private static final ThreadLocal context = new ThreadLocal<>();
+
+ public static void setConfig(JSONObject config) {
+ context.set(new ProcessMessageContext(config));
+ }
+
+ public static void setStepName(String stepName) {
+ ProcessMessageContext processMessageContext = context.get();
+ if (processMessageContext != null) {
+ processMessageContext.setStepName(stepName);
+ }
+ }
+
+ public static String getStepName() {
+ ProcessMessageContext processMessageContext = context.get();
+ if (processMessageContext != null) {
+ return processMessageContext.getStepName();
+ }
+ return StringUtils.EMPTY;
+ }
+
+ public static void release() {
+ context.remove();
+ }
+
+ public static List getEffectiveStepUuidList() {
+ ProcessMessageContext processMessageContext = context.get();
+ if (processMessageContext == null) {
+ return new ArrayList<>();
+ }
+ List effectiveStepUuidList = processMessageContext.getEffectiveStepUuidList();
+ if (effectiveStepUuidList == null) {
+ List allProcessStepRelList = getProcessStepRelList();
+ String startStepUuid = null;
+ String endStepUuid = null;
+ JSONObject process = processMessageContext.getConfig();
+ JSONArray stepList = process.getJSONArray("stepList");
+ for (int i = 0; i < stepList.size(); i++) {
+ JSONObject step = stepList.getJSONObject(i);
+ if (MapUtils.isEmpty(step)) {
+ continue;
+ }
+ String handler = step.getString("handler");
+ if (Objects.equals(handler, ProcessStepHandlerType.START.getHandler())) {
+ startStepUuid = step.getString("uuid");
+ } else if (Objects.equals(handler, ProcessStepHandlerType.END.getHandler())) {
+ endStepUuid = step.getString("uuid");
+ }
+ }
+ List> routeList = new ArrayList<>();
+ List routeStepList = new ArrayList<>();
+ routeList.add(routeStepList);
+ getAllRouteList(startStepUuid, routeList, routeStepList, endStepUuid, allProcessStepRelList);
+ // 有效的步骤UUID列表
+ effectiveStepUuidList = new ArrayList<>();
+ for (List routeStepUuidList : routeList) {
+ for (String routeStepUuid : routeStepUuidList) {
+ if (!effectiveStepUuidList.contains(routeStepUuid)) {
+ effectiveStepUuidList.add(routeStepUuid);
+ }
+ }
+ }
+ List connectionList = new ArrayList<>();
+ for (ProcessStepRelVo processStepRelVo : allProcessStepRelList) {
+ if (effectiveStepUuidList.contains(processStepRelVo.getFromStepUuid()) && effectiveStepUuidList.contains(processStepRelVo.getToStepUuid())) {
+ connectionList.add(processStepRelVo);
+ }
+ }
+ processMessageContext.setConnectionList(connectionList);
+ processMessageContext.setEffectiveStepUuidList(effectiveStepUuidList);
+ }
+ return effectiveStepUuidList;
+ }
+
+ public static List getProcessStepRelList() {
+ ProcessMessageContext processMessageContext = context.get();
+ if (processMessageContext == null) {
+ return new ArrayList<>();
+ }
+ List processStepRelList = processMessageContext.getConnectionList();
+ if (processStepRelList == null) {
+ JSONObject process = processMessageContext.getConfig();
+ JSONArray connectionList = process.getJSONArray("connectionList");
+ if (connectionList == null) {
+ connectionList = new JSONArray();
+ }
+ for (int i = connectionList.size() - 1; i >= 0; i--) {
+ JSONObject connectionObj = connectionList.getJSONObject(i);
+ if (MapUtils.isEmpty(connectionObj)) {
+ connectionList.remove(i);
+ }
+ if (StringUtils.isBlank(connectionObj.getString("uuid"))) {
+ connectionList.remove(i);
+ }
+ if (StringUtils.isBlank(connectionObj.getString("fromStepUuid"))) {
+ connectionList.remove(i);
+ }
+ if (StringUtils.isBlank(connectionObj.getString("toStepUuid"))) {
+ connectionList.remove(i);
+ }
+ if (StringUtils.isBlank(connectionObj.getString("type"))) {
+ connectionList.remove(i);
+ }
+ }
+ processStepRelList = connectionList.toJavaList(ProcessStepRelVo.class);
+ processMessageContext.setConnectionList(processStepRelList);
+ }
+ return processStepRelList;
+ }
+
+ /**
+ *
+ * @param stepUuid 当前步骤uuid
+ * @param routeList 收集所有后置路经列表
+ * @param routeStepList 遍历过的步骤列表
+ * @param endStepUuid 结束步骤uuid
+ * @param allProcessStepRelList 所有连线列表
+ */
+ private static void getAllRouteList(String stepUuid, List> routeList, List routeStepList, String endStepUuid, List allProcessStepRelList) {
+ if (!routeStepList.contains(stepUuid)) {
+ routeStepList.add(stepUuid);
+ if (!stepUuid.equals(endStepUuid)) {
+ List toStepUuidList = new ArrayList<>();
+ for (ProcessStepRelVo processStepRelVo : allProcessStepRelList) {
+ if (Objects.equals(processStepRelVo.getFromStepUuid(), stepUuid) && Objects.equals(processStepRelVo.getType(), ProcessFlowDirection.FORWARD.getValue())) {
+ toStepUuidList.add(processStepRelVo.getToStepUuid());
+ }
+ }
+ List tmpRouteStepList = new ArrayList<>(routeStepList);
+ for (int i = 0; i < toStepUuidList.size(); i++) {
+ String toStepUuid = toStepUuidList.get(i);
+ if (i == 0) {
+ getAllRouteList(toStepUuid, routeList, routeStepList, endStepUuid, allProcessStepRelList);
+ } else {
+ List newRouteStepList = new ArrayList<>(tmpRouteStepList);
+ routeList.add(newRouteStepList);
+ getAllRouteList(toStepUuid, routeList, newRouteStepList, endStepUuid, allProcessStepRelList);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/neatlogic/framework/process/util/ProcessConfigUtil.java b/src/main/java/neatlogic/framework/process/util/ProcessConfigUtil.java
index 0e1d7d54..d4e8f614 100644
--- a/src/main/java/neatlogic/framework/process/util/ProcessConfigUtil.java
+++ b/src/main/java/neatlogic/framework/process/util/ProcessConfigUtil.java
@@ -22,10 +22,13 @@ import neatlogic.framework.form.constvalue.FormAttributeAction;
import neatlogic.framework.form.constvalue.FormAttributeAuthRange;
import neatlogic.framework.form.constvalue.FormAttributeAuthType;
import neatlogic.framework.process.constvalue.*;
+import neatlogic.framework.process.exception.process.ProcessConfigException;
import neatlogic.framework.process.exception.process.ProcessStepUtilHandlerNotFoundException;
import neatlogic.framework.process.stephandler.core.IProcessStepInternalHandler;
+import neatlogic.framework.process.stephandler.core.ProcessMessageManager;
import neatlogic.framework.process.stephandler.core.ProcessStepInternalHandlerFactory;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@@ -330,7 +333,7 @@ public class ProcessConfigUtil {
policyObj.put("type", WorkerPolicy.COPY.getValue());
policyObj.put("isChecked", 0);
JSONObject config = new JSONObject();
- config.put("processStepUuid", "");//TODO 这里是单选,应该改成processStepUuid
+ config.put("processStepUuid", "");
policyObj.put("config", config);
policyMap.put(WorkerPolicy.COPY, policyObj);
}
@@ -370,6 +373,7 @@ public class ProcessConfigUtil {
}
JSONArray policyList = workerPolicyConfig.getJSONArray("policyList");
if (CollectionUtils.isNotEmpty(policyList)) {
+ List effectiveStepUuidList = ProcessMessageManager.getEffectiveStepUuidList();
for (int i = 0; i < policyList.size(); i++) {
JSONObject policyObj = policyList.getJSONObject(i);
if (MapUtils.isNotEmpty(policyObj)) {
@@ -395,19 +399,32 @@ public class ProcessConfigUtil {
}
JSONArray processStepUuidList = configObj.getJSONArray("processStepUuidList");
if (CollectionUtils.isNotEmpty(processStepUuidList)) {
+ processStepUuidList.retainAll(effectiveStepUuidList);
configObject.put("processStepUuidList", processStepUuidList);
}
+ JSONArray processStepList = new JSONArray();
JSONArray processStepArray = configObj.getJSONArray("processStepList");
if (CollectionUtils.isNotEmpty(processStepArray)) {
- JSONArray processStepList = new JSONArray();
for (int j = 0; j < processStepArray.size(); j++) {
JSONObject processStepObj = processStepArray.getJSONObject(j);
if (MapUtils.isEmpty(processStepObj)) {
continue;
}
- if (StringUtils.isBlank(processStepObj.getString("uuid"))) {
+ String uuid = processStepObj.getString("uuid");
+ if (StringUtils.isBlank(uuid)) {
continue;
}
+ if (!effectiveStepUuidList.contains(uuid)) {
+ throw new ProcessConfigException(ProcessConfigException.Type.PRE_STEP_ASSIGN, ProcessMessageManager.getStepName());
+ }
+ JSONArray conditionUuidArray = processStepObj.getJSONArray("condition");
+ if (CollectionUtils.isNotEmpty(conditionUuidArray)) {
+ List conditionUuidList = conditionUuidArray.toJavaList(String.class);
+ List list = ListUtils.removeAll(conditionUuidList, effectiveStepUuidList);
+ if (CollectionUtils.isNotEmpty(list)) {
+ throw new ProcessConfigException(ProcessConfigException.Type.PRE_STEP_ASSIGN_CONDITION_STEP, ProcessMessageManager.getStepName());
+ }
+ }
processStepList.add(processStepObj);
}
configObject.put("processStepList", processStepList);
@@ -424,6 +441,9 @@ public class ProcessConfigUtil {
case COPY:
String processStepUuid = configObj.getString("processStepUuid");
if (StringUtils.isNotBlank(processStepUuid)) {
+ if (!effectiveStepUuidList.contains(processStepUuid)) {
+ throw new ProcessConfigException(ProcessConfigException.Type.COPY, ProcessMessageManager.getStepName());
+ }
configObject.put("processStepUuid", processStepUuid);
}
break;
@@ -525,53 +545,43 @@ public class ProcessConfigUtil {
}
JSONObject process = configObj.getJSONObject("process");
if (MapUtils.isNotEmpty(process)) {
- JSONArray connectionList = process.getJSONArray("connectionList");
- process.remove("connectionList");
-// String source = JSONObject.toJSONString(process, SerializerFeature.MapSortField);
- IProcessStepInternalHandler processStepInternalHandler = ProcessStepInternalHandlerFactory.getHandler(ProcessStepHandlerType.END.getHandler());
- if (processStepInternalHandler == null) {
- throw new ProcessStepUtilHandlerNotFoundException(ProcessStepHandlerType.END.getHandler());
- }
- JSONObject processObj = processStepInternalHandler.regulateProcessStepConfig(process);
- JSONArray stepList = process.getJSONArray("stepList");
- if (CollectionUtils.isNotEmpty(stepList)) {
- stepList.removeIf(Objects::isNull);
- for (int i = 0; i < stepList.size(); i++) {
- JSONObject step = stepList.getJSONObject(i);
- String handler = step.getString("handler");
- if (!Objects.equals(handler, ProcessStepHandlerType.END.getHandler())) {
- processStepInternalHandler = ProcessStepInternalHandlerFactory.getHandler(handler);
- if (processStepInternalHandler == null) {
- throw new ProcessStepUtilHandlerNotFoundException(handler);
+ try {
+ ProcessMessageManager.setConfig(process);
+ IProcessStepInternalHandler processStepInternalHandler = ProcessStepInternalHandlerFactory.getHandler(ProcessStepHandlerType.END.getHandler());
+ if (processStepInternalHandler == null) {
+ throw new ProcessStepUtilHandlerNotFoundException(ProcessStepHandlerType.END.getHandler());
+ }
+ JSONObject processObj = processStepInternalHandler.regulateProcessStepConfig(process);
+ JSONArray stepList = process.getJSONArray("stepList");
+ if (CollectionUtils.isNotEmpty(stepList)) {
+ stepList.removeIf(Objects::isNull);
+ List effectiveStepUuidList = ProcessMessageManager.getEffectiveStepUuidList();
+ for (int i = stepList.size() - 1; i >= 0; i--) {
+ JSONObject step = stepList.getJSONObject(i);
+ String uuid = step.getString("uuid");
+ if (!effectiveStepUuidList.contains(uuid)) {
+ stepList.remove(i);
+ continue;
+ }
+ ProcessMessageManager.setStepName(step.getString("name"));
+ String handler = step.getString("handler");
+ if (!Objects.equals(handler, ProcessStepHandlerType.END.getHandler())) {
+ processStepInternalHandler = ProcessStepInternalHandlerFactory.getHandler(handler);
+ if (processStepInternalHandler == null) {
+ throw new ProcessStepUtilHandlerNotFoundException(handler);
+ }
+ JSONObject stepConfig = step.getJSONObject("stepConfig");
+ JSONObject stepConfigObj = processStepInternalHandler.regulateProcessStepConfig(stepConfig);
+ step.put("stepConfig", stepConfigObj);
}
- JSONObject stepConfig = step.getJSONObject("stepConfig");
- JSONObject stepConfigObj = processStepInternalHandler.regulateProcessStepConfig(stepConfig);
- step.put("stepConfig", stepConfigObj);
}
}
+ processObj.put("stepList", stepList);
+ processObj.put("connectionList", ProcessMessageManager.getProcessStepRelList());
+ configObj.put("process", processObj);
+ } finally {
+ ProcessMessageManager.release();
}
- processObj.put("stepList", stepList);
-// String target = JSONObject.toJSONString(processObj, SerializerFeature.MapSortField);
- if (CollectionUtils.isNotEmpty(connectionList)) {
- connectionList.removeIf(Objects::isNull);
- } else {
- connectionList = new JSONArray();
- }
- processObj.put("connectionList", connectionList);
- configObj.put("process", processObj);
-// System.out.println("-------------------------");
-// List segmentPairList = LCSUtil.LCSCompare(source, target);
-// List oldSegmentRangeList = new ArrayList<>();
-// List newSegmentRangeList = new ArrayList<>();
-// for(SegmentPair segmentpair : segmentPairList) {
-// oldSegmentRangeList.add(new SegmentRange(segmentpair.getOldBeginIndex(), segmentpair.getOldEndIndex(), segmentpair.isMatch()));
-// newSegmentRangeList.add(new SegmentRange(segmentpair.getNewBeginIndex(), segmentpair.getNewEndIndex(), segmentpair.isMatch()));
-// }
-// LCSUtil.wrapChangePlace(source, oldSegmentRangeList, LCSUtil.SPAN_CLASS_DELETE, LCSUtil.SPAN_END);
-// PrintSingeColorFormatUtil.println();
-// LCSUtil.wrapChangePlace(target, newSegmentRangeList, LCSUtil.SPAN_CLASS_INSERT, LCSUtil.SPAN_END);
-// PrintSingeColorFormatUtil.println();
-// System.out.println("=========================");
}
return configObj.toJSONString();
}
--
Gitee