private ActionForward executeOperation(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response, CandidacyOperation candidacyOperation) throws FenixServiceException,
FenixActionException {
final User userView = getUserView(request);
if (candidacyOperation == null) {
// possible due to first-time candidacy summary generation link in manager portal
candidacyOperation = new PrintAllDocumentsOperation(RoleType.STUDENT, getCandidacy(request));
} else {
ExecuteStateOperation.run(candidacyOperation, getLoggedPerson(request));
}
if (candidacyOperation.getType() == CandidacyOperationType.PRINT_SCHEDULE) {
final List<InfoShowOccupation> infoLessons = ReadStudentTimeTable.run(getCandidacy(request).getRegistration(), null);
request.setAttribute("person", getCandidacy(request).getPerson());
request.setAttribute("infoLessons", infoLessons);
return mapping.findForward("printSchedule");
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_REGISTRATION_DECLARATION) {
request.setAttribute("registration", getCandidacy(request).getRegistration());
request.setAttribute("executionYear", getCandidacy(request).getExecutionDegree().getExecutionYear());
return mapping.findForward("printRegistrationDeclaration");
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_UNDER_23_TRANSPORTS_DECLARATION) {
request.setAttribute("person", getCandidacy(request).getRegistration().getPerson());
request.setAttribute("campus", getCandidacy(request).getRegistration().getCampus().getName());
request.setAttribute("executionYear", getCandidacy(request).getExecutionDegree().getExecutionYear());
return mapping.findForward("printUnder23TransportsDeclation");
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_MEASUREMENT_TEST_DATE) {
request.setAttribute("registration", getCandidacy(request).getRegistration());
return mapping.findForward("printMeasurementTestDate");
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_ALL_DOCUMENTS) {
StudentCandidacy candidacy = getCandidacy(request);
request.setAttribute("candidacy", candidacy);
request.setAttribute("registration", candidacy.getRegistration());
request.setAttribute("executionYear", candidacy.getExecutionDegree().getExecutionYear());
request.setAttribute("person", candidacy.getRegistration().getPerson());
request.setAttribute("campus", candidacy.getRegistration().getCampus().getName());
request.setAttribute("administrativeOfficeFeeAndInsurancePaymentCode",
administrativeOfficeFeeAndInsurancePaymentCode(candidacy.getAvailablePaymentCodesSet()));
request.setAttribute("installmentPaymentCodes", installmmentPaymentCodes(candidacy.getAvailablePaymentCodesSet()));
request.setAttribute("totalGratuityPaymentCode", totalGratuityPaymentCode(candidacy.getAvailablePaymentCodesSet()));
request.setAttribute(
"firstInstallmentEndDate",
calculateFirstInstallmentEndDate(candidacy.getRegistration(), getCandidacy(request)
.getAvailablePaymentCodesSet()));
request.setAttribute("sibsEntityCode", FenixEduAcademicConfiguration.getConfiguration().getSibsEntityCode());
final List<InfoShowOccupation> infoLessons = ReadStudentTimeTable.run(candidacy.getRegistration(), null);
request.setAttribute("infoLessons", infoLessons);
// FIXME: Cannot continue to be supported this way, tutorship is an optional dependency
// List<Tutorship> activeTutorships = Tutorship.getActiveTutorships(candidacy.getRegistration().getStudent());
// if (!activeTutorships.isEmpty()) {
// Tutorship tutorship = activeTutorships.iterator().next();
// request.setAttribute("tutor", tutorship.getTeacher().getPerson());
// }
return mapping.findForward("printAllDocuments");
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_SYSTEM_ACCESS_DATA) {
request.setAttribute("person", userView.getPerson());
return mapping.findForward("printSystemAccessData");
} else if (candidacyOperation.getType() == CandidacyOperationType.FILL_PERSONAL_DATA) {
request.setAttribute(
"aditionalInformation",
getResources(request).getMessage("label.candidacy.username.changed.message",
userView.getPerson().getUsername(), Unit.getInstitutionAcronym()));
} else if (candidacyOperation.getType() == CandidacyOperationType.PRINT_GRATUITY_PAYMENT_CODES) {
request.setAttribute("registration", getCandidacy(request).getRegistration());
request.setAttribute("paymentCodes", getCandidacy(request).getAvailablePaymentCodesSet());
request.setAttribute("sibsEntityCode", FenixEduAcademicConfiguration.getConfiguration().getSibsEntityCode());
request.setAttribute("administrativeOfficeFeeAndInsurancePaymentCode",