This is an automated email from the ASF dual-hosted git repository.
wenhemin pushed a commit to branch json_split
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/json_split by this push:
new 8d6c2e3 fix copy locations name error (#5228)
8d6c2e3 is described below
commit 8d6c2e3a6ca29439089b417bbd30debd72e7004e
Author: Simon <[email protected]>
AuthorDate: Wed Apr 7 17:17:51 2021 +0800
fix copy locations name error (#5228)
---
.../api/service/impl/ProcessDefinitionServiceImpl.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
index dedc230..9365f68 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@@ -1404,8 +1404,16 @@ public class ProcessDefinitionServiceImpl extends
BaseServiceImpl implements Pro
} else {
ProcessData processData =
processService.genProcessData(processDefinition);
List<TaskNode> taskNodeList = processData.getTasks();
+ String locations = processDefinition.getLocations();
+ ObjectNode locationsJN = JSONUtils.parseObject(locations);
+
taskNodeList.forEach(taskNode -> {
- taskNode.setName(taskNode.getName() + "_copy_" +
DateUtils.getCurrentTimeStamp());
+ String suffix = "_copy_" + DateUtils.getCurrentTimeStamp();
+ String id = taskNode.getId();
+ String newName = locationsJN.path(id).path("name").asText() +
suffix;
+ ((ObjectNode) locationsJN.get(id)).put("name", newName);
+
+ taskNode.setName(taskNode.getName() + suffix);
taskNode.setCode("0");
});
processData.setTasks(taskNodeList);
@@ -1416,7 +1424,7 @@ public class ProcessDefinitionServiceImpl extends
BaseServiceImpl implements Pro
processDefinition.getName() + "_copy_" +
DateUtils.getCurrentTimeStamp(),
processDefinitionJson,
processDefinition.getDescription(),
- processDefinition.getLocations(),
+ locationsJN.toString(),
processDefinition.getConnects());
}