public ActionForward cancelAcademicServiceRequest(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixFilterException, FenixServiceException {

    final RegistrationAcademicServiceRequest academicServiceRequest =
        getAndSetAcademicServiceRequest(request);
    final String justification =
        ((AcademicServiceRequestsManagementForm) actionForm).getJustification();

    try {
      academicServiceRequest.cancel(justification);
    } catch (DomainExceptionWithLabelFormatter ex) {
      addActionMessage(
          request, ex.getKey(), solveLabelFormatterArgs(request, ex.getLabelFormatterArgs()));
      return mapping.findForward("prepareCancelAcademicServiceRequest");
    } catch (DomainException ex) {
      addActionMessage(request, ex.getKey());
      return mapping.findForward("prepareCancelAcademicServiceRequest");
    }

    request.setAttribute("registration", academicServiceRequest.getRegistration());
    return mapping.findForward("viewRegistrationDetails");
  }
  public ActionForward receiveAcademicServiceRequest(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixFilterException, FenixServiceException {

    final RegistrationAcademicServiceRequest serviceRequest =
        getAndSetAcademicServiceRequest(request);
    final AcademicServiceRequestBean requestBean =
        (AcademicServiceRequestBean) getObjectFromViewState("serviceRequestBean");

    try {
      serviceRequest.receivedFromExternalEntity(
          requestBean.getSituationDate(), requestBean.getJustification());

    } catch (DomainExceptionWithLabelFormatter ex) {
      addActionMessage(
          request, ex.getKey(), solveLabelFormatterArgs(request, ex.getLabelFormatterArgs()));
      request.setAttribute("serviceRequestBean", requestBean);
      return mapping.findForward("prepareReceiveAcademicServiceRequest");
    } catch (DomainException ex) {
      addActionMessage(request, ex.getKey());
      request.setAttribute("serviceRequestBean", requestBean);
      return mapping.findForward("prepareReceiveAcademicServiceRequest");
    }

    request.setAttribute("registration", serviceRequest.getRegistration());
    return mapping.findForward("viewRegistrationDetails");
  }
  public ActionForward concludeAcademicServiceRequest(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixFilterException, 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 (RegistrationAgreement.MOBILITY_AGREEMENTS.contains(
        academicServiceRequest.getRegistration().getRegistrationAgreement())) {
      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");
  }