Package org.fenixedu.academic.domain.curricularRules

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


    public Double getMaxEctsCredits(final ExecutionSemester executionSemester) {
        final CreditsLimit creditsLimitRule = getCreditsLimitRule(executionSemester);
        if (creditsLimitRule != null) {
            return creditsLimitRule.getMaximumCredits();
        }
        final AnyCurricularCourse anyCurricularCourseRule = getAnyCurricularCourseRule(executionSemester);
        if (anyCurricularCourseRule != null) {
            return anyCurricularCourseRule.hasCredits() ? anyCurricularCourseRule.getCredits() : 0;
        }
        return Double.valueOf(0d);
    }
View Full Code Here


    public Double getMinEctsCredits(ExecutionSemester executionSemester) {
        final CreditsLimit creditsLimitRule = getCreditsLimitRule(executionSemester);
        if (creditsLimitRule != null) {
            return creditsLimitRule.getMinimumCredits();
        }
        final AnyCurricularCourse anyCurricularCourseRule = getAnyCurricularCourseRule(executionSemester);
        if (anyCurricularCourseRule != null) {
            return anyCurricularCourseRule.hasCredits() ? anyCurricularCourseRule.getCredits() : 0;
        }
        return Double.valueOf(0d);
    }
View Full Code Here

     */
    @Override
    protected RuleResult executeEnrolmentVerificationWithRules(final ICurricularRule curricularRule,
            IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate, final EnrolmentContext enrolmentContext) {

        final AnyCurricularCourse rule = (AnyCurricularCourse) curricularRule;

        if (!rule.appliesToContext(sourceDegreeModuleToEvaluate.getContext())) {
            return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule());
        }

        final CurricularCourse curricularCourseToEnrol;
        if (sourceDegreeModuleToEvaluate.isEnroling()) {
            final OptionalDegreeModuleToEnrol optionalDegreeModuleToEnrol =
                    (OptionalDegreeModuleToEnrol) sourceDegreeModuleToEvaluate;
            curricularCourseToEnrol = optionalDegreeModuleToEnrol.getCurricularCourse();

            if (isApproved(enrolmentContext, curricularCourseToEnrol) || isEnroled(enrolmentContext, curricularCourseToEnrol)
                    || isApproved(enrolmentContext, optionalDegreeModuleToEnrol.getCurricularCourse())
                    || isEnroled(enrolmentContext, optionalDegreeModuleToEnrol.getCurricularCourse())) {

                return RuleResult.createFalse(sourceDegreeModuleToEvaluate.getDegreeModule(),
                        "curricularRules.ruleExecutors.AnyCurricularCourseExecutor.already.approved.or.enroled",
                        curricularCourseToEnrol.getName(), rule.getDegreeModuleToApplyRule().getName());
            }

        } else if (sourceDegreeModuleToEvaluate.isEnroled()) {
            curricularCourseToEnrol =
                    (CurricularCourse) ((EnroledOptionalEnrolment) sourceDegreeModuleToEvaluate).getCurriculumModule()
                            .getDegreeModule();
        } else {
            throw new DomainException(
                    "error.curricularRules.executors.ruleExecutors.AnyCurricularCourseExecutor.unexpected.degree.module.to.evaluate");
        }

        final ExecutionSemester executionSemester = enrolmentContext.getExecutionPeriod();
        final Degree degree = curricularCourseToEnrol.getDegree();

        boolean result = true;

        result &=
                rule.hasMinimumCredits() ? rule.getMinimumCredits() <= curricularCourseToEnrol.getEctsCredits(executionSemester) : true;

        result &=
                rule.hasMaximumCredits() ? rule.getMaximumCredits() >= curricularCourseToEnrol.getEctsCredits(executionSemester) : true;

        result &=
                rule.getDegree() != null ? rule.getDegree() == degree : rule.hasBolonhaDegreeType() ? degree.getDegreeType() == rule
                        .getBolonhaDegreeType() : true;

        if (rule.getDepartmentUnit() != null) {
            final DepartmentUnit departmentUnit =
                    curricularCourseToEnrol.getCompetenceCourse().getDepartmentUnit(executionSemester);
            result &= departmentUnit != null && departmentUnit.equals(rule.getDepartmentUnit());
        }

        if (result) {
            return RuleResult.createTrue(sourceDegreeModuleToEvaluate.getDegreeModule());
        } else {
View Full Code Here

    }

    public Integer getMinimumYear() {
        if (getViewState().getAttribute("minimumYear") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                if (anyCurricularCourse.getMinimumYear() != null) {
                    setMinimumYear(anyCurricularCourse.getMinimumYear());
                }
            }
        }
        return (Integer) getViewState().getAttribute("minimumYear");
    }
View Full Code Here

    }

    public Integer getMaximumYear() {
        if (getViewState().getAttribute("maximumYear") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                if (anyCurricularCourse.getMaximumYear() != null) {
                    setMaximumYear(anyCurricularCourse.getMaximumYear());
                }
            }
        }
        return (Integer) getViewState().getAttribute("maximumYear");
    }
View Full Code Here

    }

    public Double getCredits() {
        if (getViewState().getAttribute("credits") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                if (anyCurricularCourse.getCredits() != null) {
                    setCredits(anyCurricularCourse.getCredits());
                }
            }
        }
        return (Double) getViewState().getAttribute("credits");
    }
View Full Code Here

    }

    public String getSelectedDegreeType() {
        if (getViewState().getAttribute("selectedDegreeType") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                if (anyCurricularCourse.getBolonhaDegreeType() != null) {
                    setSelectedDegreeType(anyCurricularCourse.getBolonhaDegreeType().name());
                }
            }
        }
        return (String) getViewState().getAttribute("selectedDegreeType");
    }
View Full Code Here

    }

    public String getSelectedDegreeID() {
        if (getViewState().getAttribute("selectedDegreeID") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                setSelectedDegreeID(anyCurricularCourse.getDegree() != null ? anyCurricularCourse.getDegree().getExternalId() : NO_SELECTION_STRING);
            } else {
                setSelectedDegreeID(NO_SELECTION_STRING);
            }
        }
        return (String) getViewState().getAttribute("selectedDegreeID");
View Full Code Here

    }

    public String getSelectedDepartmentUnitID() {
        if (getViewState().getAttribute("selectedDepartmentUnitID") == null) {
            if (getCurricularRule() != null && getCurricularRule() instanceof AnyCurricularCourse) {
                AnyCurricularCourse anyCurricularCourse = (AnyCurricularCourse) getCurricularRule();
                setSelectedDepartmentUnitID(anyCurricularCourse.getDepartmentUnit() != null ? anyCurricularCourse
                        .getDepartmentUnit().getExternalId() : NO_SELECTION_STRING);
            } else {
                setSelectedDepartmentUnitID(NO_SELECTION_STRING);
            }
        }
View Full Code Here

TOP

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

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.