if (!StringUtils.isEmpty(request.getParameter("executionCourseID"))) {
request.setAttribute("executionCourseID", request.getParameter("executionCourseID"));
}
try {
ShiftEnrollmentErrorReport errorReport =
EnrollStudentInShifts.runEnrollStudentInShifts(getRegistration(request), shiftId);
if (errorReport.getUnAvailableShifts().size() > 0) {
for (final Shift shift : (List<Shift>) errorReport.getUnAvailableShifts()) {
if (shift.getLotacao().intValue() == 0) {
addActionMessage(request, "error.shift.enrollment.capacityLocked", shift.getNome());
} else if (shift.getLotacao().intValue() < 0) {
addActionMessage(request, "message.warning.student.enrolmentClasses.first.year.first.semester");
} else {
addActionMessage(request, "error.shift.enrollment.capacityExceded", shift.getNome());
}
}
}
if (errorReport.getUnExistingShifts().size() > 0) {
addActionMessage(request, "error.shift.enrollment.nonExistingShift");
}
} catch (StudentNotFoundServiceException e) {
logger.error(e.getMessage(), e);
addActionMessage(request, "error.shift.enrollment.nonExistingStudent");