lenboo commented on a change in pull request #4555:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/4555#discussion_r565101553



##########
File path: 
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -1990,4 +1992,59 @@ public String formatTaskAppId(TaskInstance taskInstance) 
{
             taskInstance.getId());
     }
 
+    /**
+     * solve the branch rename bug
+     *
+     * @param processData
+     * @param oldProcessData
+     * @return String
+     */
+    public String changeJson(ProcessData processData, ProcessData 
oldProcessData) {
+        HashMap<String, String> oldNameTaskId = new HashMap<>();
+        List<TaskNode> oldTasks = oldProcessData.getTasks();
+        for (int i = 0; i < oldTasks.size(); i++) {
+            TaskNode taskNode = oldTasks.get(i);
+            String oldName = taskNode.getName();
+            String oldId = taskNode.getId();
+            oldNameTaskId.put(oldName, oldId);
+        }
+
+        // take the processdefinitionjson saved this time, and then save the 
taskid and name
+        HashMap<String, String> newNameTaskId = new HashMap<>();
+        List<TaskNode> newTasks = processData.getTasks();
+        for (int i = 0; i < newTasks.size(); i++) {
+            TaskNode taskNode = newTasks.get(i);
+            String newId = taskNode.getId();
+            String newName = taskNode.getName();
+            newNameTaskId.put(newId, newName);
+        }
+
+        // replace the previous conditionresult with a new one
+        List<TaskNode> tasks = processData.getTasks();
+        for (int i = 0; i < tasks.size(); i++) {
+            TaskNode taskNode = newTasks.get(i);
+            String type = taskNode.getType().toLowerCase();
+            if (TaskType.CONDITIONS.getDescp().equals(type)) {

Review comment:
       you can use equalsIgnoreCase instead of equals




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to