|
|
|
@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.api.dto.DagDataSchedule;
|
|
|
|
|
import org.apache.dolphinscheduler.api.dto.treeview.Instance; |
|
|
|
|
import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; |
|
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
|
import org.apache.dolphinscheduler.api.exceptions.ServiceException; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProcessInstanceService; |
|
|
|
|
import org.apache.dolphinscheduler.api.service.ProjectService; |
|
|
|
@ -59,6 +60,7 @@ import org.apache.dolphinscheduler.dao.entity.Tenant;
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; |
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; |
|
|
|
@ -143,6 +145,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessTaskRelationMapper processTaskRelationMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ProcessTaskRelationLogMapper processTaskRelationLogMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
TaskDefinitionLogMapper taskDefinitionLogMapper; |
|
|
|
|
|
|
|
|
@ -1422,6 +1427,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
* @return delele result code |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
|
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { |
|
|
|
|
Project project = projectMapper.queryByCode(projectCode); |
|
|
|
|
//check user access for project
|
|
|
|
@ -1434,7 +1440,12 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|
|
|
|
if (processDefinition == null) { |
|
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); |
|
|
|
|
} else { |
|
|
|
|
processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); |
|
|
|
|
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); |
|
|
|
|
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(processDefinition.getCode(), processDefinition.getVersion()); |
|
|
|
|
if ((deleteLog & deleteRelationLog) == 0) { |
|
|
|
|
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
} |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|