Source:
<code>public ActionForward proceedToShiftEnrolment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { checkParameter(request); final String classIdSelected = readClassSelected(request); final Registration registration = getAndSetRegistration(request); if (registration == null) { addActionMessage(request, "errors.impossible.operation"); return mapping.getInputForward(); } final ExecutionCourse executionCourse = getExecutionCourse(request); final List<SchoolClass> schoolClassesToEnrol = readStudentSchoolClassesToEnrolUsingExecutionCourse(request, registration, executionCourse); request.setAttribute("schoolClassesToEnrol", schoolClassesToEnrol); if (schoolClassesToEnrol.isEmpty()) { return mapping.findForward("prepareShiftEnrollment"); } final SchoolClass schoolClass = setSelectedSchoolClass(request, classIdSelected, schoolClassesToEnrol); final ExecutionSemester executionSemester = getDomainObject(request, "executionSemesterID"); final List<InfoShowOccupation> infoClasslessons = ReadClassTimeTableByStudent.runReadClassTimeTableByStudent(registration, schoolClass, executionCourse, executionSemester); request.setAttribute("infoClasslessons", infoClasslessons); request.setAttribute("infoClasslessonsEndTime", Integer.valueOf(getEndTime(infoClasslessons))); final List<InfoShowOccupation> infoLessons = new ArrayList<InfoShowOccupation>(); <START> for (Registration reg : registration.getStudent().getAllRegistrations()) { <END> infoLessons.addAll(ReadStudentTimeTable.run(reg, executionSemester)); } request.setAttribute("person", registration.getPerson()); request.setAttribute("infoLessons", infoLessons); request.setAttribute("infoLessonsEndTime", Integer.valueOf(getEndTime(infoLessons))); request.setAttribute("executionSemesterID", executionSemester.getExternalId()); return mapping.findForward("showShiftsToEnroll"); }</code><technical_language>Avoid calling getAllRegistrations() method. poor performance</technical_language>

Target:
public ActionForward proceedToShiftEnrolment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { checkParameter(request); final String classIdSelected = readClassSelected(request); final Registration registration = getAndSetRegistration(request); if (registration == null) { addActionMessage(request, "errors.impossible.operation"); return mapping.getInputForward(); } final ExecutionCourse executionCourse = getExecutionCourse(request); final List<SchoolClass> schoolClassesToEnrol = readStudentSchoolClassesToEnrolUsingExecutionCourse(request, registration, executionCourse); request.setAttribute("schoolClassesToEnrol", schoolClassesToEnrol); if (schoolClassesToEnrol.isEmpty()) { return mapping.findForward("prepareShiftEnrollment"); } final SchoolClass schoolClass = setSelectedSchoolClass(request, classIdSelected, schoolClassesToEnrol); final ExecutionSemester executionSemester = getDomainObject(request, "executionSemesterID"); final List<InfoShowOccupation> infoClasslessons = ReadClassTimeTableByStudent.runReadClassTimeTableByStudent(registration, schoolClass, executionCourse, executionSemester); request.setAttribute("infoClasslessons", infoClasslessons); request.setAttribute("infoClasslessonsEndTime", Integer.valueOf(getEndTime(infoClasslessons))); final List<InfoShowOccupation> infoLessons = new ArrayList<InfoShowOccupation>(); for (Registration reg : registration.getStudent().getRegistrationStream().collect(Collectors.toList())) { infoLessons.addAll(ReadStudentTimeTable.run(reg, executionSemester)); } request.setAttribute("person", registration.getPerson()); request.setAttribute("infoLessons", infoLessons); request.setAttribute("infoLessonsEndTime", Integer.valueOf(getEndTime(infoLessons))); request.setAttribute("executionSemesterID", executionSemester.getExternalId()); return mapping.findForward("showShiftsToEnroll"); }