private List<AssignmentAggregateReportElement> findAssignmentsWithoutBookings(
      List<User> users, List<Project> projects, DateRange reportRange, boolean showZeroBookings) {
    List<AssignmentAggregateReportElement> elements = Lists.newArrayList();

    if (showZeroBookings) {
      List<Integer> userIds = DomainUtil.getIdsFromDomainObjects(users);
      List<Integer> projectIds = DomainUtil.getIdsFromDomainObjects(projects);

      List<ProjectAssignment> filterAssignmentsWithoutBookings =
          getAssignmentsWithoutBookings(reportRange, userIds, projectIds);

      for (ProjectAssignment filterAssignmentsWithoutBooking : filterAssignmentsWithoutBookings) {
        elements.add(new AssignmentAggregateReportElement(filterAssignmentsWithoutBooking));
      }
    }
    return elements;
  }
Example #2
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));
  }