private void deleteAnyAssignments(Project project) throws ParentChildConstraintException { for (ProjectAssignment assignment : project.getProjectAssignments()) { projectAssignmentManagementService.deleteProjectAssignment(assignment); } project.getProjectAssignments().clear(); }
private void deleteEmptyAssignments(Project project) throws ParentChildConstraintException { checkProjectDeletability(project); if (project.getProjectAssignments() != null && project.getProjectAssignments().size() > 0) { deleteAnyAssignments(project); } }
public void setProjectDeletability(Project project) { List<Integer> ids = DomainUtil.getIdsFromDomainObjects(project.getProjectAssignments()); List<AssignmentAggregateReportElement> aggregates = null; if (ids != null && ids.size() > 0) { aggregates = aggregateReportService.getHoursPerAssignment(ids); } project.setDeletable(ReportUtil.isEmptyAggregateList(aggregates)); }
private void checkProjectDeletability(Project project) throws ParentChildConstraintException { setProjectDeletability(project); if (!project.isDeletable()) { LOGGER.debug( "Can't delete project, still has " + project.getProjectAssignments().size() + " assignments"); throw new ParentChildConstraintException("Project assignments still attached"); } }
@Override @Transactional public void validatePMRoles(Project project) { userService.validateProjectManagementRoles( project.getProjectManager() == null ? null : project.getProjectManager().getUserId()); }
private void assignUsersToDefaultProject(Project project) { if (project.isDefaultProject() && project.isActive()) { projectAssignmentManagementService.assignAllUsersToProject(project); } }