healchow commented on code in PR #6524:
URL: https://github.com/apache/inlong/pull/6524#discussion_r1021383013


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/InlongGroupServiceImpl.java:
##########
@@ -465,7 +465,7 @@ public Boolean delete(String groupId, String operator) {
         // logically delete the associated extension info
         groupExtMapper.logicDeleteAllByGroupId(groupId);
 
-        if 
(GroupStatus.allowedLogicDelete(GroupStatus.forCode(entity.getStatus()))) {
+        if 
(GroupStatus.notAllowedDelete(GroupStatus.forCode(entity.getStatus()))) {
             streamService.logicDeleteAll(groupId, operator);

Review Comment:
   Fixed.



##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/enums/GroupStatus.java:
##########
@@ -117,40 +115,55 @@ public static boolean notAllowedUpdate(GroupStatus 
status) {
     }
 
     /**
-     * Checks whether the given status allows deleting operate.
+     * Checks whether the given status allows updating the MQ type of inlong 
group.
      */
-    public static boolean notAllowedDelete(GroupStatus status) {
-        return status == GroupStatus.TO_BE_APPROVAL
-                || status == GroupStatus.CONFIG_ING
-                || status == GroupStatus.SUSPENDING
-                || status == GroupStatus.RESTARTING;
+    public static boolean allowedUpdateMQ(GroupStatus status) {
+        return status == GroupStatus.TO_BE_SUBMIT
+                || status == GroupStatus.TO_BE_APPROVAL
+                || status == GroupStatus.APPROVE_REJECTED
+                || status == GroupStatus.CONFIG_FAILED;
     }
 
     /**
-     * Checks whether the given status allows suspending operate.
+     * Checks whether the given status needs to delete the inlong stream first.
      */
-    public static boolean allowedSuspend(GroupStatus status) {
-        return status == GroupStatus.CONFIG_SUCCESSFUL
-                || status == GroupStatus.RESTARTED
+    public static boolean deleteStreamFirst(GroupStatus status) {
+        return status == GroupStatus.APPROVE_PASSED
+                || status == GroupStatus.CONFIG_FAILED
+                || status == GroupStatus.CONFIG_SUCCESSFUL
                 || status == GroupStatus.SUSPENDED
+                || status == GroupStatus.RESTARTED
                 || status == GroupStatus.FINISH;
     }
 
     /**
-     * Only the {@link GroupStatus#DRAFT} and {@link GroupStatus#TO_BE_SUBMIT} 
status
-     * allows change the MQ type of inlong group.
+     * Checks whether the given status allows deleting other infos,
+     * <p/>
+     * If true, will logically delete all related infos, including streams, 
sources, sinks, etc.
+     */
+    public static boolean allowedDeleteSubInfos(GroupStatus status) {
+        return status == GroupStatus.TO_BE_SUBMIT
+                || status == GroupStatus.APPROVE_REJECTED
+                || status == GroupStatus.DELETED;
+    }
+
+    /**
+     * Checks whether the given status allows suspending operate.
      */
-    public static boolean notAllowedUpdateMQ(GroupStatus status) {
-        return status != GroupStatus.DRAFT && status != 
GroupStatus.TO_BE_SUBMIT
-                && status != GroupStatus.TO_BE_APPROVAL && status != 
GroupStatus.APPROVE_REJECTED
-                && status != GroupStatus.CONFIG_FAILED;
+    public static boolean allowedSuspend(GroupStatus status) {
+        return status == GroupStatus.CONFIG_SUCCESSFUL
+                || status == GroupStatus.RESTARTED
+                || status == GroupStatus.SUSPENDED
+                || status == GroupStatus.FINISH;
     }
 
     /**
      * Temporary group status, adding, deleting and modifying operations are 
not allowed
      */
     public static boolean isTempStatus(GroupStatus status) {
-        return status == TO_BE_APPROVAL || status == CONFIG_ING;
+        return status == TO_BE_APPROVAL || status == CONFIG_ING
+                || status == SUSPENDING || status == RESTARTING
+                ;

Review Comment:
   Done, thanks.



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to