Package org.fenixedu.academic.domain.curricularRules

Examples of org.fenixedu.academic.domain.curricularRules.DegreeModulesSelectionLimit


        }
    }

    @SuppressWarnings("unchecked")
    private boolean checkDegreeModulesSelectionLimit(ExecutionYear executionYear) {
        final DegreeModulesSelectionLimit degreeModulesSelectionLimit =
                (DegreeModulesSelectionLimit) getMostRecentActiveCurricularRule(
                        CurricularRuleType.DEGREE_MODULES_SELECTION_LIMIT, executionYear);

        if (degreeModulesSelectionLimit == null) {
            return false;
        } else {
            int modulesConcluded = 0;
            for (CurriculumModule curriculumModule : getCurriculumModulesSet()) {
                if (curriculumModule.isConcluded(executionYear).value()) {
                    modulesConcluded++;
                }
            }

            return modulesConcluded >= degreeModulesSelectionLimit.getMinimumLimit();
        }
    }
View Full Code Here


        return result;

    }

    private int getMinModules(final CourseGroup courseGroup, final ExecutionSemester executionSemester) {
        final DegreeModulesSelectionLimit degreeModulesSelectionLimit =
                courseGroup.getDegreeModulesSelectionLimitRule(executionSemester);
        if (degreeModulesSelectionLimit != null) {
            return degreeModulesSelectionLimit.getMinimumLimit();
        }

        final CreditsLimit creditsLimit = courseGroup.getCreditsLimitRule(executionSemester);
        if (creditsLimit != null) {
            final SortedSet<DegreeModule> sortedChilds =
View Full Code Here

        return courseGroup.getChildDegreeModulesValidOn(executionSemester).size();
    }

    private int getMaxModules(final CourseGroup courseGroup, final ExecutionSemester executionSemester) {
        final DegreeModulesSelectionLimit degreeModulesSelectionLimit =
                courseGroup.getDegreeModulesSelectionLimitRule(executionSemester);
        if (degreeModulesSelectionLimit != null) {
            return degreeModulesSelectionLimit.getMaximumLimit();
        }

        final CreditsLimit creditsLimit = courseGroup.getCreditsLimitRule(executionSemester);
        if (creditsLimit != null) {
            final SortedSet<DegreeModule> sortedChilds =
View Full Code Here

    @Override
    protected RuleResult executeEnrolmentWithRulesAndTemporaryEnrolment(final ICurricularRule curricularRule,
            final IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate, final EnrolmentContext enrolmentContext) {

        final DegreeModulesSelectionLimit rule = (DegreeModulesSelectionLimit) curricularRule;

        if (!canApplyRule(enrolmentContext, rule)) {
            return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
        }

        final IDegreeModuleToEvaluate degreeModuleToEvaluate = searchDegreeModuleToEvaluate(enrolmentContext, rule);

        if (degreeModuleToEvaluate.isEnroled()) {

            final CourseGroup courseGroup = rule.getDegreeModuleToApplyRule();
            final EnroledCurriculumModuleWrapper moduleEnroledWrapper = (EnroledCurriculumModuleWrapper) degreeModuleToEvaluate;
            final CurriculumGroup curriculumGroup = (CurriculumGroup) moduleEnroledWrapper.getCurriculumModule();

            int total = countTotalDegreeModules(enrolmentContext, courseGroup, curriculumGroup);

            if (rule.numberOfDegreeModulesExceedMaximum(total)) {
                if (sourceDegreeModuleToEvaluate.isEnroled() && sourceDegreeModuleToEvaluate.isLeaf()) {
                    return createImpossibleRuleResult(rule, sourceDegreeModuleToEvaluate);
                } else {
                    return createFalseRuleResult(rule, sourceDegreeModuleToEvaluate);
                }
            }

            final ExecutionSemester executionSemester = enrolmentContext.getExecutionPeriod();
            total += curriculumGroup.getNumberOfChildEnrolments(executionSemester.getPreviousExecutionPeriod());

            return rule.numberOfDegreeModulesExceedMaximum(total) ? RuleResult.createTrue(EnrolmentResultType.TEMPORARY,
                    sourceDegreeModuleToEvaluate.getDegreeModule()) : RuleResult.createTrue(sourceDegreeModuleToEvaluate
                    .getDegreeModule());
        }
        // is enrolling now
        return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
View Full Code Here

    }

    @Override
    protected RuleResult executeEnrolmentVerificationWithRules(ICurricularRule curricularRule,
            IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate, EnrolmentContext enrolmentContext) {
        final DegreeModulesSelectionLimit rule = (DegreeModulesSelectionLimit) curricularRule;

        if (!canApplyRule(enrolmentContext, rule)) {
            return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
        }

        final IDegreeModuleToEvaluate degreeModuleToEvaluate = searchDegreeModuleToEvaluate(enrolmentContext, rule);

        if (degreeModuleToEvaluate.isEnroled()) {

            final EnroledCurriculumModuleWrapper moduleEnroledWrapper = (EnroledCurriculumModuleWrapper) degreeModuleToEvaluate;
            final CourseGroup courseGroup = rule.getDegreeModuleToApplyRule();
            final CurriculumGroup curriculumGroup = (CurriculumGroup) moduleEnroledWrapper.getCurriculumModule();

            int total = countTotalDegreeModules(enrolmentContext, courseGroup, curriculumGroup);
            if (rule.numberOfDegreeModulesExceedMaximum(total)) {
                if (sourceDegreeModuleToEvaluate.isEnroled() && sourceDegreeModuleToEvaluate.isLeaf()) {
                    return createImpossibleRuleResult(rule, sourceDegreeModuleToEvaluate);
                } else {
                    return createFalseRuleResult(rule, sourceDegreeModuleToEvaluate);
                }
View Full Code Here

    public Collection<CourseGroup> getNotOptionalChildCourseGroups(final ExecutionSemester executionSemester) {

        final Collection<DegreeModule> degreeModules = getDegreeModulesByExecutionPeriod(executionSemester);
        final Collection<CurricularRule> curricularRules = getCurricularRulesByExecutionPeriod(executionSemester);
        final DegreeModulesSelectionLimit degreeModulesSelectionLimit = getDegreeModulesSelectionLimitRule(curricularRules);

        if (degreeModulesSelectionLimit != null) {

            if (degreeModulesSelectionLimit.getMinimumLimit().equals(degreeModulesSelectionLimit.getMaximumLimit())
                    && degreeModulesSelectionLimit.getMaximumLimit().equals(degreeModules.size())) {

                return filterCourseGroups(degreeModules);

            } else {
                return Collections.EMPTY_LIST;
View Full Code Here

            }
            return creditsLimitRules.iterator().next().getMaximumCredits();
        }

        final Collection<DegreeModule> modulesByExecutionPeriod = getOpenChildDegreeModulesByExecutionPeriod(executionSemester);
        final DegreeModulesSelectionLimit modulesSelectionLimit = getDegreeModulesSelectionLimitRule(executionSemester);
        if (modulesSelectionLimit != null) {
            return countMaxEctsCredits(modulesByExecutionPeriod, executionSemester, modulesSelectionLimit.getMaximumLimit());
        }

        return countMaxEctsCredits(modulesByExecutionPeriod, executionSemester, modulesByExecutionPeriod.size());
    }
View Full Code Here

            }
            return creditsLimitRules.iterator().next().getMinimumCredits();
        }

        final Collection<DegreeModule> modulesByExecutionPeriod = getOpenChildDegreeModulesByExecutionPeriod(executionSemester);
        final DegreeModulesSelectionLimit modulesSelectionLimit = getDegreeModulesSelectionLimitRule(executionSemester);
        if (modulesSelectionLimit != null) {
            return countMinEctsCredits(modulesByExecutionPeriod, executionSemester, modulesSelectionLimit.getMinimumLimit());
        }

        return countMinEctsCredits(modulesByExecutionPeriod, executionSemester, modulesByExecutionPeriod.size());
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.curricularRules.DegreeModulesSelectionLimit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.