github-code-scanning[bot] commented on code in PR #13103:
URL:
https://github.com/apache/dolphinscheduler/pull/13103#discussion_r1040703244
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:
##########
@@ -487,6 +492,115 @@
return execute(loginUser, processDefinition.getProjectCode(),
workflowInstanceId, executeType);
}
+ /**
+ * do action to execute task in process instance
+ *
+ * @param loginUser login user
+ * @param projectCode project code
+ * @param processInstanceId process instance id
+ * @param startNodeList start node list
+ * @param taskDependType task depend type
+ * @return execute result code
+ */
+ @Override
+ public WorkflowExecuteResponse executeTask(User loginUser, long
projectCode, Integer processInstanceId,
+ String startNodeList,
TaskDependType taskDependType) {
+
+ WorkflowExecuteResponse response = new WorkflowExecuteResponse();
+
+ Project project = projectMapper.queryByCode(projectCode);
+ // check user access for project
+
+ projectService.checkProjectAndAuthThrowException(loginUser, project,
+
ApiFuncIdentificationConstant.map.get(ExecuteType.EXECUTE_TASK));
+
+ ProcessInstance processInstance =
processService.findProcessInstanceDetailById(processInstanceId)
+ .orElseThrow(() -> new
ServiceException(Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
+
+ if (!processInstance.getState().isFinished()) {
+ logger.error("Can not execute task for process instance which is
not finished, processInstanceId:{}.",
+ processInstanceId);
+ putMsg(response, Status.WORKFLOW_INSTANCE_IS_NOT_FINISHED);
+ return response;
+ }
+
+ ProcessDefinition processDefinition =
+
processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
+ processInstance.getProcessDefinitionVersion());
+ processDefinition.setReleaseState(ReleaseState.ONLINE);
+ this.checkProcessDefinitionValid(projectCode, processDefinition,
processInstance.getProcessDefinitionCode(),
+ processInstance.getProcessDefinitionVersion());
+
+ if (!checkTenantSuitable(processDefinition)) {
+ logger.error(
+ "There is not any valid tenant for the process definition,
processDefinitionId:{}, processDefinitionCode:{}, ",
+ processDefinition.getId(), processDefinition.getName());
+ putMsg(response, Status.TENANT_NOT_SUITABLE);
+ }
+
+ // get the startParams user specified at the first starting while
repeat running is needed
+
+ long startNodeListLong;
+ try {
+ startNodeListLong = Long.parseLong(startNodeList);
+ } catch (NumberFormatException e) {
+ logger.error("startNodeList is not a number, startNodeList:{}",
startNodeList);
Review Comment:
## Log Injection
This log entry depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/2385)
--
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]