github-advanced-security[bot] commented on code in PR #16545:
URL: 
https://github.com/apache/dolphinscheduler/pull/16545#discussion_r1735843379


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverFailureTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverFailureTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverFailureTasksRequest, 
WorkflowInstanceRecoverFailureTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverFailureTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.START_FAILURE_TASK_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverFailureTasksRequest.getUserId())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.executorId](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4831)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/AbstractWorkflowInstanceTrigger.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import org.apache.dolphinscheduler.dao.repository.CommandDao;
+import org.apache.dolphinscheduler.dao.repository.UserDao;
+import org.apache.dolphinscheduler.dao.repository.WorkflowDefinitionLogDao;
+import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Slf4j
+public abstract class AbstractWorkflowInstanceTrigger<TriggerRequest, 
TriggerResponse>
+        implements
+            IWorkflowTrigger<TriggerRequest, TriggerResponse> {
+
+    @Autowired
+    private WorkflowDefinitionLogDao workflowDefinitionDao;
+
+    @Autowired
+    private WorkflowInstanceDao workflowInstanceDao;
+
+    @Autowired
+    private UserDao userDao;
+
+    @Autowired
+    private CommandDao commandDao;
+
+    @Override
+    @Transactional
+    public TriggerResponse triggerWorkflow(final TriggerRequest 
triggerRequest) {
+        final WorkflowInstance workflowInstance = 
constructWorkflowInstance(triggerRequest);
+        workflowInstanceDao.updateById(workflowInstance);
+
+        final Command command = constructTriggerCommand(triggerRequest, 
workflowInstance);
+        commandDao.insert(command);
+
+        return onTriggerSuccess(workflowInstance);
+    }
+
+    protected abstract WorkflowInstance constructWorkflowInstance(final 
TriggerRequest triggerRequest);
+
+    protected abstract Command constructTriggerCommand(final TriggerRequest 
triggerRequest,
+                                                       final WorkflowInstance 
workflowInstance);
+
+    protected abstract TriggerResponse onTriggerSuccess(final WorkflowInstance 
workflowInstance);

Review Comment:
   ## Useless parameter
   
   The parameter 'workflowInstance' is never used.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4828)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverSuspendTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverSuspendTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverSuspendTasksRequest, 
WorkflowInstanceRecoverSuspendTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverSuspendTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.RECOVER_SUSPENDED_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverSuspendTasksRequest.getUserId())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.executorId](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4834)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverFailureTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverFailureTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverFailureTasksRequest, 
WorkflowInstanceRecoverFailureTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverFailureTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.START_FAILURE_TASK_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverFailureTasksRequest.getUserId())
+                .startTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.startTime](1) should be avoided because it has been 
deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4830)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverFailureTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverFailureTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverFailureTasksRequest, 
WorkflowInstanceRecoverFailureTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverFailureTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverFailureTasksRequest 
workflowInstanceRecoverFailureTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.START_FAILURE_TASK_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverFailureTasksRequest.getUserId())
+                .startTime(new Date())
+                .updateTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.updateTime](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4829)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverSuspendTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverSuspendTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverSuspendTasksRequest, 
WorkflowInstanceRecoverSuspendTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverSuspendTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.RECOVER_SUSPENDED_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverSuspendTasksRequest.getUserId())
+                .startTime(new Date())
+                .updateTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.updateTime](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4832)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRepeatTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRepeatTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRepeatRunningRequest, 
WorkflowInstanceRepeatRunningResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest) {
+        return 
getWorkflowInstance(repeatRunningRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.REPEAT_RUNNING)
+                .processInstanceId(workflowInstance.getId())
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .executorId(repeatRunningRequest.getUserId())
+                .startTime(new Date())
+                .updateTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.updateTime](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4835)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRepeatTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRepeatTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRepeatRunningRequest, 
WorkflowInstanceRepeatRunningResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest) {
+        return 
getWorkflowInstance(repeatRunningRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.REPEAT_RUNNING)
+                .processInstanceId(workflowInstance.getId())
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .executorId(repeatRunningRequest.getUserId())
+                .startTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.startTime](1) should be avoided because it has been 
deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4836)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRecoverSuspendTaskTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRecoverSuspendTaskTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRecoverSuspendTasksRequest, 
WorkflowInstanceRecoverSuspendTasksResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest) {
+        return 
getWorkflowInstance(workflowInstanceRecoverSuspendTasksRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRecoverSuspendTasksRequest 
workflowInstanceRecoverSuspendTasksRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.RECOVER_SUSPENDED_PROCESS)
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .processInstanceId(workflowInstance.getId())
+                
.executorId(workflowInstanceRecoverSuspendTasksRequest.getUserId())
+                .startTime(new Date())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.startTime](1) should be avoided because it has been 
deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4833)



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/WorkflowInstanceRepeatTrigger.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.server.master.engine.workflow.trigger;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.dao.entity.Command;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningRequest;
+import 
org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRepeatRunningResponse;
+
+import java.util.Date;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowInstanceRepeatTrigger
+        extends
+            
AbstractWorkflowInstanceTrigger<WorkflowInstanceRepeatRunningRequest, 
WorkflowInstanceRepeatRunningResponse> {
+
+    @Override
+    protected WorkflowInstance constructWorkflowInstance(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest) {
+        return 
getWorkflowInstance(repeatRunningRequest.getWorkflowInstanceId());
+    }
+
+    @Override
+    protected Command constructTriggerCommand(final 
WorkflowInstanceRepeatRunningRequest repeatRunningRequest,
+                                              final WorkflowInstance 
workflowInstance) {
+        return Command.builder()
+                .commandType(CommandType.REPEAT_RUNNING)
+                .processInstanceId(workflowInstance.getId())
+                
.processDefinitionCode(workflowInstance.getProcessDefinitionCode())
+                
.processDefinitionVersion(workflowInstance.getProcessDefinitionVersion())
+                .executorId(repeatRunningRequest.getUserId())

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [CommandBuilder.executorId](1) should be avoided because it has 
been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/4837)



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