Package org.fenixedu.academic.domain.studentCurriculum.StudentCurricularPlanEnrolmentPreConditions

Examples of org.fenixedu.academic.domain.studentCurriculum.StudentCurricularPlanEnrolmentPreConditions.EnrolmentPreConditionResult


    @Override
    protected ActionForward prepareShowDegreeModulesToEnrol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response, StudentCurricularPlan studentCurricularPlan, ExecutionSemester executionSemester) {

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkPreConditionsToEnrol(studentCurricularPlan, executionSemester);

        if (!result.isValid()) {
            if (result.getEnrolmentPeriod() != null) {
                DateTime now = DateTime.now().withMillisOfSecond(0);
                DateTime start = result.getEnrolmentPeriod().getStartDateDateTime();
                Period period = new Period(start.getMillis() - now.getMillis());
                if (start.toLocalDate().equals(now.toLocalDate())) {
                    request.setAttribute("now", now);
                    request.setAttribute("start", start);
                    request.setAttribute("remaining", FORMATTER.print(period));
                }
            }
            addActionMessage(request, result.message(), result.args());
            return mapping.findForward("enrollmentCannotProceed");
        }

        return super.prepareShowDegreeModulesToEnrol(mapping, form, request, response, studentCurricularPlan, executionSemester);
    }
View Full Code Here


        }
    }

    protected void checkDebts() {

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkDebts(getStudentCurricularPlan());

        if (!result.isValid()) {
            throw new DomainException(result.message(), result.args());
        }
    }
View Full Code Here

        if (getCurricularRuleLevel() != CurricularRuleLevel.ENROLMENT_WITH_RULES) {
            throw new DomainException("error.StudentCurricularPlan.invalid.curricular.rule.level");
        }

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkEnrolmentPeriods(getStudentCurricularPlan(),
                        getExecutionSemester());

        if (!result.isValid()) {
            throw new DomainException(result.message(), result.args());
        }
    }
View Full Code Here

    }

    private boolean canContinueToEnrolment(final HttpServletRequest request, final StudentCurricularPlan studentCurricularPlan,
            final ExecutionSemester executionSemester) {

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkPreConditionsToEnrol(studentCurricularPlan, executionSemester);

        if (!result.isValid()) {

            addActionMessage(request, result.message(), result.args());
            return false;

        } else {
            return true;
        }
View Full Code Here

        if (getCurricularRuleLevel() != CurricularRuleLevel.SPECIAL_SEASON_ENROLMENT) {
            throw new DomainException("error.StudentCurricularPlan.invalid.curricular.rule.level");
        }

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkEnrolmentPeriodsForSpecialSeason(getStudentCurricularPlan(),
                        getExecutionSemester());

        if (!result.isValid()) {
            throw new DomainException(result.message(), result.args());
        }
    }
View Full Code Here

    }

    private static void checkConditionsToEnrol(final StudentCurricularPlan studentCurricularPlan,
            final ExecutionSemester executionSemester) throws FenixServiceException {

        final EnrolmentPreConditionResult result =
                StudentCurricularPlanEnrolmentPreConditions.checkPreConditionsToEnrol(studentCurricularPlan, executionSemester);

        if (!result.isValid()) {
            throw new FenixServiceException(result.message(), result.args());
        }
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.studentCurriculum.StudentCurricularPlanEnrolmentPreConditions.EnrolmentPreConditionResult

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.