コード例 #1
0
  @Override
  protected RuleResult executeEnrolmentWithRulesAndTemporaryEnrolment(
      ICurricularRule curricularRule,
      IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate,
      EnrolmentContext enrolmentContext) {
    final CreditsLimitInExternalCycle creditsLimitInExternalCycle =
        (CreditsLimitInExternalCycle) curricularRule;
    final ExternalCurriculumGroup externalCurriculumGroup =
        creditsLimitInExternalCycle.getExternalCurriculumGroup();

    if (!isToApply(sourceDegreeModuleToEvaluate, enrolmentContext, externalCurriculumGroup)) {
      return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
    }

    if (isEnrolingDissertation(enrolmentContext, externalCurriculumGroup)) {
      return createRuleResultForEnrolingDissertation(
          sourceDegreeModuleToEvaluate, creditsLimitInExternalCycle);
    }

    final CycleCurriculumGroup previousCycleCurriclumGroup =
        creditsLimitInExternalCycle.getPreviousCycleCurriculumGroup();
    final Double totalCreditsInPreviousCycle = previousCycleCurriclumGroup.getAprovedEctsCredits();

    if (!creditsLimitInExternalCycle.creditsInPreviousCycleSufficient(
        totalCreditsInPreviousCycle)) {
      return createRuleResultForNotSatisfiedCreditsForPreviousCycle(
          sourceDegreeModuleToEvaluate, creditsLimitInExternalCycle, previousCycleCurriclumGroup);
    }

    final Double totalCredits =
        calculateApprovedAndEnrollingTotalCredits(enrolmentContext, externalCurriculumGroup);
    if (creditsLimitInExternalCycle.creditsExceedMaximumInExternalCycle(
        totalCredits, totalCreditsInPreviousCycle)) {
      return createRuleResultForMaxCreditsExceededInExternalCycle(
          sourceDegreeModuleToEvaluate,
          creditsLimitInExternalCycle,
          totalCredits,
          totalCreditsInPreviousCycle);
    }

    final Double totalEctsWithEnroledEctsCreditsFromPreviousPeriod =
        totalCredits
            + externalCurriculumGroup.getEnroledEctsCredits(
                enrolmentContext.getExecutionPeriod().getPreviousExecutionPeriod());
    if (creditsLimitInExternalCycle.creditsExceedMaximumInExternalCycle(
        totalEctsWithEnroledEctsCreditsFromPreviousPeriod, totalCreditsInPreviousCycle)) {
      return RuleResult.createTrue(
          EnrolmentResultType.TEMPORARY,
          sourceDegreeModuleToEvaluate.getDegreeModule(),
          "curricularRules.ruleExecutors.CreditsLimitInExternalCycleExecutor.external.cycle.limit.exceeded",
          creditsLimitInExternalCycle.getExternalCurriculumGroup().getName().getContent(),
          totalEctsWithEnroledEctsCreditsFromPreviousPeriod.toString(),
          creditsLimitInExternalCycle
              .getMaxCreditsInExternalCycle(totalCreditsInPreviousCycle)
              .toString(),
          totalCreditsInPreviousCycle.toString());
    }

    return RuleResult.createTrue(sourceDegreeModuleToEvaluate.getDegreeModule());
  }
コード例 #2
0
ファイル: WriteMarks.java プロジェクト: Kayvlim/fenix
 private static boolean belongsToActiveExternalCycle(final Attends attend) {
   if (attend.hasEnrolment()) {
     final CycleCurriculumGroup cycle = attend.getEnrolment().getParentCycleCurriculumGroup();
     if (cycle != null && cycle.isExternal()) {
       final Student student = attend.getRegistration().getStudent();
       return student.getActiveRegistrationFor(cycle.getDegreeCurricularPlanOfDegreeModule())
           != null;
     }
   }
   return false;
 }
コード例 #3
0
  @Override
  protected RuleResult executeEnrolmentVerificationWithRules(
      ICurricularRule curricularRule,
      IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate,
      EnrolmentContext enrolmentContext) {

    final CreditsLimitInExternalCycle creditsLimitInExternalCycle =
        (CreditsLimitInExternalCycle) curricularRule;
    final ExternalCurriculumGroup externalCurriculumGroup =
        creditsLimitInExternalCycle.getExternalCurriculumGroup();

    if (!isToApply(sourceDegreeModuleToEvaluate, enrolmentContext, externalCurriculumGroup)) {
      return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
    }

    if (isEnrolingDissertation(enrolmentContext, externalCurriculumGroup)) {
      return createRuleResultForEnrolingDissertation(
          sourceDegreeModuleToEvaluate, creditsLimitInExternalCycle);
    }

    final CycleCurriculumGroup previousCycleCurriclumGroup =
        creditsLimitInExternalCycle.getPreviousCycleCurriculumGroup();
    final Double totalCreditsInPreviousCycle = previousCycleCurriclumGroup.getAprovedEctsCredits();

    if (!creditsLimitInExternalCycle.creditsInPreviousCycleSufficient(
        totalCreditsInPreviousCycle)) {
      return createRuleResultForNotSatisfiedCreditsForPreviousCycle(
          sourceDegreeModuleToEvaluate, creditsLimitInExternalCycle, previousCycleCurriclumGroup);
    }

    final Double totalCreditsInExternalCycle =
        calculateApprovedAndEnrollingTotalCredits(enrolmentContext, externalCurriculumGroup);
    if (creditsLimitInExternalCycle.creditsExceedMaximumInExternalCycle(
        totalCreditsInExternalCycle, totalCreditsInPreviousCycle)) {
      return createRuleResultForMaxCreditsExceededInExternalCycle(
          sourceDegreeModuleToEvaluate,
          creditsLimitInExternalCycle,
          totalCreditsInExternalCycle,
          totalCreditsInPreviousCycle);
    }

    return RuleResult.createTrue(sourceDegreeModuleToEvaluate.getDegreeModule());
  }
コード例 #4
0
  private RuleResult createRuleResultForNotSatisfiedCreditsForPreviousCycle(
      IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate,
      final CreditsLimitInExternalCycle creditsLimitInExternalCycle,
      final CycleCurriculumGroup previousCycleCurriclumGroup) {
    if (sourceDegreeModuleToEvaluate.isEnroled() && sourceDegreeModuleToEvaluate.isLeaf()) {
      return RuleResult.createImpossible(
          sourceDegreeModuleToEvaluate.getDegreeModule(),
          "curricularRules.ruleExecutors.CreditsLimitInExternalCycleExecutor.previous.cycle.minimum.credits.not.fulfilled",
          creditsLimitInExternalCycle.getExternalCurriculumGroup().getName().getContent(),
          creditsLimitInExternalCycle.getMinCreditsInPreviousCycle().toString(),
          previousCycleCurriclumGroup.getName().getContent());
    }

    return RuleResult.createFalse(
        sourceDegreeModuleToEvaluate.getDegreeModule(),
        "curricularRules.ruleExecutors.CreditsLimitInExternalCycleExecutor.previous.cycle.minimum.credits.not.fulfilled",
        creditsLimitInExternalCycle.getExternalCurriculumGroup().getName().getContent(),
        creditsLimitInExternalCycle.getMinCreditsInPreviousCycle().toString(),
        previousCycleCurriclumGroup.getName().getContent());
  }
コード例 #5
0
  private final Collection<ICurriculumEntry> getEntriesToReport(final boolean useConcluded) {
    final HashSet<ICurriculumEntry> result = new HashSet<ICurriculumEntry>();

    final Registration registration = getRegistration();
    ICurriculum curriculum;
    if (registration.isBolonha()) {
      for (final CycleCurriculumGroup cycle :
          registration.getLastStudentCurricularPlan().getInternalCycleCurriculumGrops()) {
        if (cycle.hasAnyApprovedCurriculumLines()
            && (useConcluded || !cycle.isConclusionProcessed())) {
          curriculum = cycle.getCurriculum(getFilteringDate());
          filterEntries(result, this, curriculum);
        }
      }
    } else {
      curriculum = getRegistration().getCurriculum(getFilteringDate());
      filterEntries(result, this, curriculum);
    }

    return result;
  }