|
|
|
@ -54,6 +54,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
@ -272,6 +273,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
|
|
|
|
|
/** |
|
|
|
|
* delete task definition |
|
|
|
|
* Only offline and no downstream dependency can be deleted |
|
|
|
|
* |
|
|
|
|
* @param loginUser login user |
|
|
|
|
* @param projectCode project code |
|
|
|
|
* @param taskCode task code |
|
|
|
@ -449,7 +451,10 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
|
|
|
|
|
} |
|
|
|
|
List<ProcessTaskRelation> upstreamTaskRelations = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); |
|
|
|
|
Set<Long> upstreamCodeSet = upstreamTaskRelations.stream().map(ProcessTaskRelation::getPreTaskCode).collect(Collectors.toSet()); |
|
|
|
|
Set<Long> upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); |
|
|
|
|
Set<Long> upstreamTaskCodes = Collections.emptySet(); |
|
|
|
|
if (StringUtils.isNotEmpty(upstreamCodes)) { |
|
|
|
|
upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isEqualCollection(upstreamCodeSet, upstreamTaskCodes) && taskDefinitionToUpdate == null) { |
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
return result; |
|
|
|
@ -740,11 +745,11 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
|
|
|
|
|
String resourceIds = taskDefinition.getResourceIds(); |
|
|
|
|
if (StringUtils.isNotBlank(resourceIds)) { |
|
|
|
|
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); |
|
|
|
|
PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,processService,resourceIdArray,loginUser.getId(),logger); |
|
|
|
|
PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger); |
|
|
|
|
try { |
|
|
|
|
permissionCheck.checkPermission(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
|
logger.error(e.getMessage(), e); |
|
|
|
|
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|