This is an automated email from the ASF dual-hosted git repository.

caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 0a6819ad14 [Chore] Fix workflow is offline can be trigger (#17008)
0a6819ad14 is described below

commit 0a6819ad14614e76c2595f0f7ec6f8570d6a490b
Author: Wenjun Ruan <[email protected]>
AuthorDate: Mon Feb 17 13:44:47 2025 +0800

    [Chore] Fix workflow is offline can be trigger (#17008)
---
 .../api/validator/workflow/BackfillWorkflowDTOValidator.java  | 11 +++++++++++
 .../api/validator/workflow/TriggerWorkflowDTOValidator.java   |  4 ++++
 2 files changed, 15 insertions(+)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java
index efc3aed35d..634d964a12 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/BackfillWorkflowDTOValidator.java
@@ -18,6 +18,8 @@
 package org.apache.dolphinscheduler.api.validator.workflow;
 
 import org.apache.dolphinscheduler.api.validator.IValidator;
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.common.enums.ReleaseState;
 
 import org.apache.commons.collections4.CollectionUtils;
 
@@ -41,5 +43,14 @@ public class BackfillWorkflowDTOValidator implements 
IValidator<BackfillWorkflow
         if (backfillParams.getExpectedParallelismNumber() < 0) {
             throw new IllegalArgumentException("expectedParallelismNumber 
should >= 0");
         }
+        if (backfillWorkflowDTO.getExecType() != CommandType.COMPLEMENT_DATA) {
+            throw new IllegalArgumentException("The execType should be 
START_PROCESS");
+        }
+        if (backfillWorkflowDTO.getWorkflowDefinition() == null) {
+            throw new IllegalArgumentException("The workflowDefinition should 
not be null");
+        }
+        if (backfillWorkflowDTO.getWorkflowDefinition().getReleaseState() != 
ReleaseState.ONLINE) {
+            throw new IllegalStateException("The workflowDefinition should be 
online");
+        }
     }
 }
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java
index bb889656a4..e994120e9d 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/workflow/TriggerWorkflowDTOValidator.java
@@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.api.validator.workflow;
 
 import org.apache.dolphinscheduler.api.validator.IValidator;
 import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.common.enums.ReleaseState;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -36,5 +37,8 @@ public class TriggerWorkflowDTOValidator implements 
IValidator<TriggerWorkflowDT
         if (triggerWorkflowDTO.getWorkflowDefinition() == null) {
             throw new IllegalArgumentException("The workflowDefinition should 
not be null");
         }
+        if (triggerWorkflowDTO.getWorkflowDefinition().getReleaseState() != 
ReleaseState.ONLINE) {
+            throw new IllegalStateException("The workflowDefinition should be 
online");
+        }
     }
 }

Reply via email to