@Override
  public Object provide(Object source, Object currentValue) {

    final ExecutionYear currentYear = ExecutionYear.readCurrentExecutionYear();
    final ExecutionYear previousYear = currentYear.getPreviousExecutionYear();
    final List<ExecutionSemester> executionSemesters = new ArrayList<ExecutionSemester>();

    SpecialSeasonStudentEnrollmentBean bean = (SpecialSeasonStudentEnrollmentBean) source;
    if (bean.getScp()
        .getDegreeCurricularPlan()
        .hasOpenSpecialSeasonEnrolmentPeriod(currentYear.getLastExecutionPeriod())) {
      executionSemesters.add(currentYear.getLastExecutionPeriod());
    }
    if (bean.getScp()
        .getDegreeCurricularPlan()
        .hasOpenSpecialSeasonEnrolmentPeriod(currentYear.getFirstExecutionPeriod())) {
      executionSemesters.add(currentYear.getFirstExecutionPeriod());
    }
    if (bean.getScp()
        .getDegreeCurricularPlan()
        .hasOpenSpecialSeasonEnrolmentPeriod(previousYear.getLastExecutionPeriod())) {
      executionSemesters.add(previousYear.getLastExecutionPeriod());
    }
    if (bean.getScp()
        .getDegreeCurricularPlan()
        .hasOpenSpecialSeasonEnrolmentPeriod(previousYear.getFirstExecutionPeriod())) {
      executionSemesters.add(previousYear.getFirstExecutionPeriod());
    }

    Collections.sort(executionSemesters, ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR);
    Collections.reverse(executionSemesters);
    return executionSemesters;
  }
Exemplo n.º 2
0
  public BigDecimal getNumberOfApprovedEctsOneYearAgo() {
    ExecutionYear oneYearAgo = getForExecutionYear().getPreviousExecutionYear();
    BigDecimal result = BigDecimal.ZERO;

    if (student == null) {
      return BigDecimal.ZERO;
    }

    for (final Registration registration : student.getRegistrationsSet()) {

      if (registration.isBolonha() && registration.hasAnyEnrolmentsIn(oneYearAgo)) {
        result =
            result
                .add(
                    calculateApprovedECTS(
                        registration
                            .getLastStudentCurricularPlan()
                            .getAprovedEnrolmentsInExecutionPeriod(
                                oneYearAgo.getFirstExecutionPeriod())))
                .add(
                    calculateApprovedECTS(
                        registration
                            .getLastStudentCurricularPlan()
                            .getAprovedEnrolmentsInExecutionPeriod(
                                oneYearAgo.getLastExecutionPeriod())));
      }
    }

    return result;
  }