zhangyongtian commented on code in PR #14164:
URL: 
https://github.com/apache/dolphinscheduler/pull/14164#discussion_r1199936435


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java:
##########
@@ -3054,4 +3055,31 @@ public void deleteOtherRelation(Project project, 
Map<String, Object> result, Pro
 
     }
 
+    /**
+     * batch release process definitions based on codes and releaseState.
+     *
+     * @param loginUser    login user
+     * @param projectCode  project code
+     * @param codes        process definition code list
+     * @param releaseState releaseState
+     * @return Result of the batch release process definitions.
+     */
+    @Override
+    @Transactional
+    public Map<String, Object> batchReleaseProcessDefinitionsByCodes(User 
loginUser, long projectCode, String codes,
+                                                                     
ReleaseState releaseState) {
+        Map<String, Object> result = new HashMap<>();
+        if (StringUtils.isEmpty(codes)) {
+            log.error("Parameter processDefinitionCodes is empty, projectCode 
is {}.", projectCode);

Review Comment:
   Yes, I feel it's better to use warn. I'll make some changes then



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java:
##########
@@ -3054,4 +3055,31 @@ public void deleteOtherRelation(Project project, 
Map<String, Object> result, Pro
 
     }
 
+    /**
+     * batch release process definitions based on codes and releaseState.
+     *
+     * @param loginUser    login user
+     * @param projectCode  project code
+     * @param codes        process definition code list
+     * @param releaseState releaseState
+     * @return Result of the batch release process definitions.
+     */
+    @Override
+    @Transactional
+    public Map<String, Object> batchReleaseProcessDefinitionsByCodes(User 
loginUser, long projectCode, String codes,
+                                                                     
ReleaseState releaseState) {
+        Map<String, Object> result = new HashMap<>();
+        if (StringUtils.isEmpty(codes)) {
+            log.error("Parameter processDefinitionCodes is empty, projectCode 
is {}.", projectCode);
+            putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY);
+            return result;
+        }
+
+        Set<Long> definitionCodes = 
Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
+                .collect(Collectors.toSet());
+        for (Long definitionCode : definitionCodes) {
+            result = releaseProcessDefinition(loginUser, projectCode, 
definitionCode, releaseState);

Review Comment:
   It seems like this is the case. It would be a bit opportunistic to achieve 
this. I will improve it later. Thank you



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to