示例#1
0
  private void deleteAnyAssignments(Project project) throws ParentChildConstraintException {
    for (ProjectAssignment assignment : project.getProjectAssignments()) {
      projectAssignmentManagementService.deleteProjectAssignment(assignment);
    }

    project.getProjectAssignments().clear();
  }
示例#2
0
  private void deleteEmptyAssignments(Project project) throws ParentChildConstraintException {
    checkProjectDeletability(project);

    if (project.getProjectAssignments() != null && project.getProjectAssignments().size() > 0) {
      deleteAnyAssignments(project);
    }
  }
示例#3
0
  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));
  }
示例#4
0
  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");
    }
  }
示例#5
0
 @Override
 @Transactional
 public void validatePMRoles(Project project) {
   userService.validateProjectManagementRoles(
       project.getProjectManager() == null ? null : project.getProjectManager().getUserId());
 }
示例#6
0
 private void assignUsersToDefaultProject(Project project) {
   if (project.isDefaultProject() && project.isActive()) {
     projectAssignmentManagementService.assignAllUsersToProject(project);
   }
 }