Browse Source

[Improvement][Api] Interface and entity optimization to improve code scalability. (#10483)

* [Improvement][Api] Interface and entity optimization to improve code scalability (#10466).

* [Improvement][Api] Interface and entity optimization to improve code scalability (#10466).

* [Improvement][Api] Interface and entity optimization to improve code scalability (#10466).

* [Improvement][Api] Interface and entity optimization to improve code scalability (#10466).

* fix ut timezone.

* [Improvement][Api] Interface and entity optimization to improve code scalability.

* [Improvement][Api] Interface and entity optimization to improve code scalability.

Co-authored-by: houshitao <shitaohou@163.com>
3.1.0-release
hstdream 2 years ago committed by GitHub
parent
commit
f1a9c0d8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 86
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  2. 28
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

86
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java

@ -26,6 +26,7 @@ import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.User;
@ -463,5 +464,90 @@ public interface ProcessDefinitionService {
* @return Json String
*/
String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition);
/**
* update dag define
* @param loginUser
* @param taskRelationList
* @param processDefinition
* @param processDefinitionDeepCopy
* @param taskDefinitionLogs
* @param otherParamsJson
*/
Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs,
String otherParamsJson);
/**
* check task relation
* @param taskRelationList
* @param taskRelationJson
* @param taskDefinitionLogs
* @return
*/
Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs);
/**
* check task define
* @param taskDefinitionLogs
* @param taskDefinitionJson
* @return
*/
Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson);
/**
* create dag define
* @param loginUser
* @param taskRelationList
* @param processDefinition
* @param taskDefinitionLogs
* @param otherParamsJson
* @return
*/
Map<String, Object> createDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson);
/**
*
* @param loginUser
* @param targetProjectCode
* @param failedProcessList
* @param processDefinitionCodes
* @param result
* @param isCopy
*/
void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy);
/**
* create dag schedule
* @param loginUser
* @param processDefinition
* @param scheduleJson
* @return
*/
Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson);
/**
* update dag schedule
* @param loginUser
* @param projectCode
* @param processDefinitionCode
* @param scheduleJson
* @return
*/
Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson);
}

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

@ -279,7 +279,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson);
}
private Map<String, Object> createDagDefine(User loginUser,
@Override
public Map<String, Object> createDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) {
@ -310,7 +311,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return result;
}
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) {
@Override
public Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (taskDefinitionLogs.isEmpty()) {
@ -338,7 +341,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return result;
}
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
@Override
public Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
@ -614,7 +618,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs, otherParamsJson);
}
private Map<String, Object> updateDagDefine(User loginUser,
@Override
public Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
@ -863,7 +868,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
/**
* download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
public void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
@ -1143,7 +1148,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
/**
* check and import
*/
private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) {
public boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
@ -1632,7 +1637,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
public boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
// Fill the vertices
for (TaskNode taskNodeResponse : taskNodeResponseList) {
@ -1733,7 +1738,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return result;
}
private void doBatchOperateProcessDefinition(User loginUser,
@Override
public void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
@ -2039,7 +2045,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return result;
}
private Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson) {
@Override
public Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (scheduleObj == null) {
@ -2162,7 +2169,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return result;
}
private Map<String, Object> updateDagSchedule(User loginUser,
public Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson) {

Loading…
Cancel
Save