コード例 #1
0
  private ExecutionSemester readExecutionSemester(HttpServletRequest request) {
    ExecutionSemester executionSemester =
        (ExecutionSemester) request.getAttribute("executionSemester");

    if (executionSemester == null) {
      executionSemester = getDomainObject(request, "executionSemesterId");
    }

    if (executionSemester == null) {
      BolonhaStudentEnrollmentBean bean = readStudentEnrolmentBean(request);
      if (bean != null) {
        executionSemester = bean.getExecutionPeriod();
      }
    }

    if (executionSemester == null) {
      List<ExecutionSemester> possibleExecutionPeriods =
          readPossibleExecutionSemestersForStudentCurricularPlan(request);
      executionSemester = possibleExecutionPeriods.get(possibleExecutionPeriods.size() - 1);
    }

    request.setAttribute("executionSemester", executionSemester);

    return executionSemester;
  }
コード例 #2
0
  public ActionForward enrolInDegreeModules(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixServiceException {

    final BolonhaStudentEnrollmentBean bolonhaStudentEnrollmentBean =
        getBolonhaStudentEnrollmentBeanFromViewState();
    try {
      final RuleResult ruleResults =
          EnrolBolonhaStudentInCurriculumValidationContext.run(
              bolonhaStudentEnrollmentBean.getStudentCurricularPlan(),
              bolonhaStudentEnrollmentBean.getExecutionPeriod(),
              bolonhaStudentEnrollmentBean.getDegreeModulesToEvaluate(),
              bolonhaStudentEnrollmentBean.getCurriculumModulesToRemove(),
              bolonhaStudentEnrollmentBean.getCurricularRuleLevel());

      if (!bolonhaStudentEnrollmentBean.getDegreeModulesToEvaluate().isEmpty()
          || !bolonhaStudentEnrollmentBean.getCurriculumModulesToRemove().isEmpty()) {
        addActionMessage("success", request, "label.save.success");
      }

      if (ruleResults.isWarning()) {
        addRuleResultMessagesToActionMessages("warning", request, ruleResults);
      }

    } catch (EnrollmentDomainException ex) {
      addRuleResultMessagesToActionMessages("error", request, ex.getFalseResult());

      return prepareStudentEnrolment(mapping, form, request, response);

    } catch (DomainException ex) {
      addActionMessage("error", request, ex.getKey(), ex.getArgs());

      return prepareStudentEnrolment(mapping, form, request, response);
    }

    RenderUtils.invalidateViewState();

    return prepareStudentEnrolment(mapping, form, request, response);
  }