|
|
|
@ -37,6 +37,7 @@ import org.apache.dolphinscheduler.common.Constants;
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.FailureStrategy; |
|
|
|
|
import org.apache.dolphinscheduler.common.enums.Priority; |
|
|
|
|
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskType; |
|
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
|
import org.apache.dolphinscheduler.common.enums.WarningType; |
|
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
@ -1308,10 +1309,10 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* batch move process definition |
|
|
|
|
* |
|
|
|
|
* @param loginUser loginUser |
|
|
|
|
* @param projectCode projectCode |
|
|
|
|
* @param codes processDefinitionCodes |
|
|
|
|
* Will be deleted |
|
|
|
|
* @param loginUser loginUser |
|
|
|
|
* @param projectCode projectCode |
|
|
|
|
* @param codes processDefinitionCodes |
|
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
@ -1378,6 +1379,18 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()); |
|
|
|
|
processDefinition.setProjectCode(targetProjectCode); |
|
|
|
|
if (isCopy) { |
|
|
|
|
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations); |
|
|
|
|
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { |
|
|
|
|
if (TaskType.CONDITIONS.getDesc().equals(taskDefinitionLog.getTaskType()) |
|
|
|
|
|| TaskType.SWITCH.getDesc().equals(taskDefinitionLog.getTaskType()) |
|
|
|
|
|| TaskType.SUB_PROCESS.getDesc().equals(taskDefinitionLog.getTaskType())) { |
|
|
|
|
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType()); |
|
|
|
|
throw new ServiceException(Status.NOT_SUPPORT_COPY_TASK_TYPE); |
|
|
|
|
} |
|
|
|
|
taskDefinitionLog.setCode(0L); |
|
|
|
|
taskDefinitionLog.setVersion(0); |
|
|
|
|
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); |
|
|
|
|
} catch (CodeGenerateException e) { |
|
|
|
@ -1388,7 +1401,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
processDefinition.setUserId(loginUser.getId()); |
|
|
|
|
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); |
|
|
|
|
try { |
|
|
|
|
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, Lists.newArrayList())); |
|
|
|
|
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR); |
|
|
|
|
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR); |
|
|
|
|