Browse Source

[Feature][JsonSplit] modify saveProcessDefine remove the duplicate code (#4810)

* Modify Project and ProjectUser Mapper

* Modify Project and ProjectUser Mapper

* project_code is bigint(20)

* modify ERROR name

* modify saveProcessDefine, remove the duplicate code with createTaskAndRelation
pull/3/MERGE
Simon 4 years ago committed by GitHub
parent
commit
abf6723d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  2. 7
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

18
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -202,16 +202,20 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
putMsg(result, Status.CREATE_PROCESS_DEFINITION);
return result;
}
ProcessDefinitionLog processDefinitionLog = processService.insertProcessDefinitionLog(loginUser, processDefinitionCode, processDefinitionName, processData,
project, desc, locations, connects);
processService.switchVersion(processDefinition, processDefinitionLog);
// TODO relationName have ?
processService.createTaskAndRelation(loginUser, project.getCode(), processDefinition, processData);
int saveResult = processService.saveProcessDefinition(loginUser, project, processDefinitionName, desc,
locations, connects, processData, processDefinition);
// return processDefinition object with ID
result.put(Constants.DATA_LIST, processDefinition.getId());
putMsg(result, Status.SUCCESS);
if (saveResult > 0) {
putMsg(result, Status.SUCCESS);
// return processDefinition object with ID
result.put(Constants.DATA_LIST, processDefinition.getId());
} else {
putMsg(result, Status.CREATE_PROCESS_DEFINITION);
}
return result;
}

7
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -2224,16 +2224,11 @@ public class ProcessService {
}
/**
* save processDefinition (including create or update processDefinition)
*
*/
public int saveProcessDefinition(User operator, Project project, String name, String desc, String locations,
String connects, ProcessData processData, ProcessDefinition processDefinition) {
List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
for (TaskNode task : taskNodeList) {
// TODO update by code directly
TaskDefinition taskDefinition = taskDefinitionMapper.queryByDefinitionName(project.getCode(), task.getName());
updateTaskDefinition(operator, project.getCode(), task, taskDefinition);
}
createTaskAndRelation(operator, project.getCode(), processDefinition, processData);
ProcessDefinitionLog processDefinitionLog = insertProcessDefinitionLog(operator, processDefinition.getCode(),
name, processData, project, desc, locations, connects);

Loading…
Cancel
Save