ListElementDTO listElementDTO = new ListElementDTO(teacher.getPerson().getNome(),
SummariesControlElementDTO listElementDTO = new SummariesControlElementDTO(teacher.getPerson().getNome(),
    private void getListing(HttpServletRequest request, String departmentID, String executionPeriodID)            throws FenixFilterException, FenixServiceException {        final Department department;        final ExecutionPeriod executionPeriod;        Object[] args = { Department.class, Integer.valueOf(departmentID) }, args1 = {                ExecutionPeriod.class, Integer.valueOf(executionPeriodID) };        try {            department = (Department) ServiceManagerServiceFactory.executeService(null,                    "ReadDomainObject", args);            executionPeriod = (ExecutionPeriod) ServiceManagerServiceFactory.executeService(null,                    "ReadDomainObject", args1);        } catch (FenixServiceException e) {            throw new FenixServiceException();        }        List<Teacher> allDepartmentTeachers = (department != null && executionPeriod != null) ? department                .getTeachers(executionPeriod.getBeginDate(), executionPeriod.getEndDate())                : new ArrayList<Teacher>();        List<ListElementDTO> allListElements = new ArrayList<ListElementDTO>();        for (Teacher teacher : allDepartmentTeachers) {            TeacherService teacherService = teacher.getTeacherServiceByExecutionPeriod(executionPeriod);            for (Professorship professorship : teacher.getProfessorships()) {                Double lessonHours = 0.0, summaryHours = 0.0, percentage = 0.0, difference = 0.0, totalSummaryHours = 0.0;                if (professorship.belongsToExecutionPeriod(executionPeriod)                        && !professorship.getExecutionCourse().isMasterDegreeOnly()) {                    for (Shift shift : professorship.getExecutionCourse().getAssociatedShifts()) {                        DegreeTeachingService degreeTeachingService = null;                        // GET LESSON HOURS                        if (teacherService != null) {                            degreeTeachingService = teacherService                                    .getDegreeTeachingServiceByShiftAndProfessorship(shift,                                            professorship);                            if (degreeTeachingService != null) {                                percentage = degreeTeachingService.getPercentage();                                lessonHours += getLessonHoursByExecutionCourseAndExecutionPeriod(                                        percentage, teacherService, professorship, shift);                            }                        }                        // GET SUMMARIES HOURS                        if (degreeTeachingService != null) {                            for (Summary summary : shift.getAssociatedSummaries()) {                                if (summary.getProfessorship() != null                                        && summary.getProfessorship().equals(professorship)) {                                    Lesson lesson = SummaryUtils.getSummaryLesson(summary);                                    if (lesson != null) {                                        summaryHours += lesson.hours();                                    } else {                                        if (!shift.getAssociatedLessons().isEmpty()) {                                            totalSummaryHours += shift.getAssociatedLessons().get(0)                                                    .hours();                                        }                                    }                                }                            }                        }                        // GET TOTAL SUMMARY HOURS                        for (Summary summary : shift.getAssociatedSummaries()) {                            if (summary.getProfessorship() != null                                    && summary.getProfessorship().equals(professorship)) {                                Lesson lesson = SummaryUtils.getSummaryLesson(summary);                                if (lesson != null) {                                    totalSummaryHours += lesson.hours();                                } else {                                    if (!shift.getAssociatedLessons().isEmpty()) {                                        totalSummaryHours += shift.getAssociatedLessons().get(0).hours();                                    }                                }                            }                        }                    }                    summaryHours = NumberUtils.formatNumber(summaryHours, 1);                    lessonHours = NumberUtils.formatNumber(lessonHours, 1);                    difference = getDifference(lessonHours, summaryHours);                    Category category = teacher.getCategory();                    String categoryName = (category != null) ? category.getCode() : "";                    ListElementDTO listElementDTO = new ListElementDTO(teacher.getPerson().getNome(),                            professorship.getExecutionCourse().getNome(), teacher.getTeacherNumber(),                            categoryName, lessonHours, summaryHours, totalSummaryHours, difference);                    allListElements.add(listElementDTO);                }            }        }        Collections.sort(allListElements, new ReverseComparator(new BeanComparator("difference")));        request.setAttribute("listElements", allListElements);    }