zixi0825 commented on a change in pull request #2884:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/2884#discussion_r444610053



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
##########
@@ -295,38 +294,209 @@ private String getResourceIds(ProcessData processData) {
     /**
      * copy process definition
      *
-     * @param loginUser   login user
-     * @param projectName project name
-     * @param processId   process definition id
-     * @return copy result code
+     * @param loginUser loginUser
+     * @param processId processId
+     * @param targetProject targetProject
+     * @return
+     * @throws JsonProcessingException
      */
-    public Map<String, Object> copyProcessDefinition(User loginUser, String 
projectName, Integer processId) throws JsonProcessingException {
+    private Map<String, Object> copyProcessDefinition(User loginUser,
+                                                     Integer processId,
+                                                     Project targetProject) 
throws JsonProcessingException {
 
         Map<String, Object> result = new HashMap<>(5);
-        Project project = projectMapper.queryByName(projectName);
-
-        Map<String, Object> checkResult = 
projectService.checkProjectAndAuth(loginUser, project, projectName);
-        Status resultStatus = (Status) checkResult.get(Constants.STATUS);
-        if (resultStatus != Status.SUCCESS) {
-            return checkResult;
-        }
 
         ProcessDefinition processDefinition = 
processDefineMapper.selectById(processId);
         if (processDefinition == null) {
             putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
             return result;
         } else {
+
             return createProcessDefinition(
                     loginUser,
-                    projectName,
+                    targetProject.getName(),
                     processDefinition.getName() + "_copy_" + 
System.currentTimeMillis(),
                     processDefinition.getProcessDefinitionJson(),
                     processDefinition.getDescription(),
                     processDefinition.getLocations(),
                     processDefinition.getConnects());
+
+        }
+    }
+
+    /**
+     * batch copy or move process definition
+     * @param loginUser loginUser
+     * @param projectName projectName
+     * @param processDefinitionIds processDefinitionIds
+     * @param targetProjectId targetProjectId
+     * @param isCopy isCopy
+     * @return
+     */
+    public Map<String, Object> batchCopyOrMoveProcessDefinition(User loginUser,
+                                                          String projectName,
+                                                          String 
processDefinitionIds,
+                                                          int targetProjectId, 
boolean isCopy){
+        Map<String, Object> result = new HashMap<>(5);

Review comment:
       The initial value of HashMap in all Controller and Service in 
DolphinScheduler is 5, so if you want to modify it, then it is best to unify 
all changes after discussion
   
   ————————————————————————————————————————————
   
在DolphinScheduler中所有的Controller和Service中HashMap的初始值都为5,所以如果要修改的话,那么最好经过讨论以后,统一全部修改




----------------------------------------------------------------
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