}
public ActionForward concludeAcademicServiceRequest(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws FenixServiceException {
Boolean sendEmail = true;
RegistrationAcademicServiceRequest academicServiceRequest = getAndSetAcademicServiceRequest(request);
final AcademicServiceRequestsManagementForm form = (AcademicServiceRequestsManagementForm) actionForm;
if (academicServiceRequest.getAcademicServiceRequestType() == AcademicServiceRequestType.SPECIAL_SEASON_REQUEST) {
if (form.getDeferRequest() == null) {
return prepareConcludeAcademicServiceRequest(mapping, actionForm, request, response);
}
final SpecialSeasonRequest specialSeasonRequest = (SpecialSeasonRequest) academicServiceRequest;
specialSeasonRequest.setDeferment(form.getDeferRequest());
academicServiceRequest = specialSeasonRequest;
}
if (academicServiceRequest.getRegistration().getRegistrationProtocol().isMobilityAgreement()) {
sendEmail = false;
}
if (academicServiceRequest.getAcademicServiceRequestType() == AcademicServiceRequestType.DIPLOMA_SUPPLEMENT_REQUEST) {
sendEmail = false;
}
try {
academicServiceRequest.conclude(getSituationDate(), getJustification(),
form.getSendEmailToStudent() != null ? form.getSendEmailToStudent() : sendEmail);
addActionMessage(request, "academic.service.request.concluded.with.success");
if (academicServiceRequest.isDocumentRequest()
&& ((DocumentRequest) academicServiceRequest).getDocumentRequestType().isAllowedToQuickDeliver()) {
return deliveredAcademicServiceRequest(mapping, actionForm, request, response);
}
} catch (DomainExceptionWithLabelFormatter ex) {
addActionMessage(request, ex.getKey(), solveLabelFormatterArgs(request, ex.getLabelFormatterArgs()));
} catch (DomainException ex) {
addActionMessage(request, ex.getKey());
}
request.setAttribute("registration", academicServiceRequest.getRegistration());
return mapping.findForward("viewRegistrationDetails");
}