Package org.fenixedu.academic.domain.studentCurriculum

Examples of org.fenixedu.academic.domain.studentCurriculum.NoCourseGroupCurriculumGroup


    }

    protected ActionForward showExtraEnrolments(NoCourseGroupEnrolmentBean bean, ActionMapping mapping, ActionForm actionForm,
            HttpServletRequest request, HttpServletResponse response) {

        final NoCourseGroupCurriculumGroup noCourseGroupCurriculumGroup = bean.getNoCourseGroupCurriculumGroup();
        if (noCourseGroupCurriculumGroup != null) {
            bean.setCurriculumGroup(noCourseGroupCurriculumGroup);
            if (noCourseGroupCurriculumGroup.hasAnyEnrolments()) {
                request.setAttribute("enrolments", noCourseGroupCurriculumGroup);
            }
        }

        request.setAttribute("enrolmentBean", bean);
View Full Code Here


            return enrolStudent(mapping, form, request, response);
        }

        StudentCurricularPlan studentCurricularPlan = erasmusBolonhaStudentEnrollmentBean.getStudentCurricularPlan();
        ExecutionSemester executionSemester = erasmusBolonhaStudentEnrollmentBean.getExecutionPeriod();
        NoCourseGroupCurriculumGroup group =
                studentCurricularPlan.getNoCourseGroupCurriculumGroup(NoCourseGroupCurriculumGroupType.STANDALONE);
        Set<CurricularCourse> remaining = new HashSet<CurricularCourse>();
        HashSet<CurricularCourse> set = new HashSet<CurricularCourse>();
        set.addAll(erasmusBolonhaStudentEnrollmentBean.getCandidacy().getCurricularCoursesSet());
        for (Enrolment enrolment : group.getEnrolments()) {
            set.add(enrolment.getCurricularCourse());
        }

        remaining.addAll(set);

        for (ErasmusExtraCurricularEnrolmentBean bean : erasmusBolonhaStudentEnrollmentBean.getExtraCurricularEnrolments()) {
            remaining.remove(bean.getCurricularCourse());
            if (group.hasEnrolmentWithEnroledState(bean.getCurricularCourse(),
                    erasmusBolonhaStudentEnrollmentBean.getExecutionPeriod())) {
                continue;
            }

            MobilityExtraEnrolmentBean mobilityExtraEnrolmentBean =
                    new MobilityExtraEnrolmentBean(studentCurricularPlan, executionSemester);

            mobilityExtraEnrolmentBean.setCurriculumGroup(studentCurricularPlan
                    .getNoCourseGroupCurriculumGroup(NoCourseGroupCurriculumGroupType.STANDALONE));
            mobilityExtraEnrolmentBean.setDegree(bean.getCurricularCourse().getDegree());
            mobilityExtraEnrolmentBean.setDegreeType(bean.getCurricularCourse().getDegree().getDegreeType());
            mobilityExtraEnrolmentBean.setDegreeCurricularPlan(bean.getCurricularCourse().getDegreeCurricularPlan());
            mobilityExtraEnrolmentBean.setSelectedCurricularCourse(bean.getCurricularCourse());
            mobilityExtraEnrolmentBean.setCurricularRuleLevel(CurricularRuleLevel.EXTRA_ENROLMENT);

            try {
                final RuleResult ruleResult = CreateExtraEnrolment.run(mobilityExtraEnrolmentBean);

                if (ruleResult.isWarning()) {
                    addRuleResultMessagesToActionMessages("warning", request, ruleResult);
                }

            } catch (final IllegalDataAccessException e) {
                addActionMessage("error", request, "error.notAuthorized");
                return enrolStudent(mapping, form, request, response);

            } catch (final EnrollmentDomainException ex) {
                addRuleResultMessagesToActionMessages("enrolmentError", request, ex.getFalseResult());
                return enrolStudent(mapping, form, request, response);

            } catch (final DomainException e) {
                addActionMessage("error", request, e.getMessage(), e.getArgs());
                return enrolStudent(mapping, form, request, response);
            }
        }

        // After adding all that I want to add, the ones that I've not added
        // that were enrolled are to be removed.
        for (Enrolment enrolment : group.getEnrolmentsBy(executionSemester)) {
            if (remaining.contains(enrolment.getCurricularCourse())) {
                studentCurricularPlan.removeCurriculumModulesFromNoCourseGroupCurriculumGroup(
                        Collections.<CurriculumModule> singletonList(enrolment), executionSemester,
                        NoCourseGroupCurriculumGroupType.STANDALONE);
            }
View Full Code Here

        checkBox.setUserValue("true");
        checkBox.setChecked(true);

        cell.setBody(checkBox);
        groupTable = createCoursesTable(container, 0);
        NoCourseGroupCurriculumGroup group =
                getBolonhaStudentEnrollmentBean().getStudentCurricularPlan().getNoCourseGroupCurriculumGroup(
                        NoCourseGroupCurriculumGroupType.STANDALONE);
        HashSet<CurricularCourse> set = new HashSet<CurricularCourse>();
        ErasmusBolonhaStudentEnrollmentBean erasmusBolonhaStudentEnrollmentBean =
                (ErasmusBolonhaStudentEnrollmentBean) getBolonhaStudentEnrollmentBean();
        set.addAll(erasmusBolonhaStudentEnrollmentBean.getCandidacy().getCurricularCoursesSet());
        for (Enrolment enrolment : group.getEnrolments()) {
            set.add(enrolment.getCurricularCourse());
        }

        for (CurricularCourse curricularCourse : set) {
            if (erasmusBolonhaStudentEnrollmentBean.getStudentCurricularPlan().getEnrolmentByCurricularCourseAndExecutionPeriod(
                    curricularCourse, erasmusBolonhaStudentEnrollmentBean.getExecutionPeriod()) != null) {
                if (!group.hasEnrolmentWithEnroledState(curricularCourse,
                        erasmusBolonhaStudentEnrollmentBean.getExecutionPeriod())) {

                    continue;
                }
            }

            if (!isContextValid(curricularCourse)) {
                continue;
            }

            htmlTableRow = groupTable.createRow();
            HtmlTableCell cellName = htmlTableRow.createCell();
            cellName.setClasses(getRenderer().getCurricularCourseToEnrolNameClasses());

            String degreeName = curricularCourse.getName();

            if (isAcademicRelationsOfficeMember() && curricularCourse instanceof CurricularCourse) {
                if (!StringUtils.isEmpty(curricularCourse.getCode())) {
                    degreeName = curricularCourse.getCode() + " - " + degreeName;
                }

                degreeName +=
                        " (" + BundleUtil.getString(Bundle.STUDENT, "label.grade.scale") + " - "
                                + curricularCourse.getGradeScaleChain().getDescription() + ") ";
            }

            cellName.setBody(new HtmlText(degreeName));

            // Year
            final HtmlTableCell yearCell = htmlTableRow.createCell();
            yearCell.setClasses(getRenderer().getCurricularCourseToEnrolYearClasses());
            yearCell.setColspan(2);
            yearCell.setBody(new HtmlText(getBolonhaStudentEnrollmentBean().getExecutionPeriod().getQualifiedName()));

            final HtmlTableCell ectsCell = htmlTableRow.createCell();
            ectsCell.setClasses(getRenderer().getCurricularCourseToEnrolEctsClasses());

            final StringBuilder ects = new StringBuilder();
            ects.append(curricularCourse.getEctsCredits()).append(" ")
                    .append(BundleUtil.getString(Bundle.STUDENT, "label.credits.abbreviation"));
            ectsCell.setBody(new HtmlText(ects.toString()));

            HtmlTableCell checkBoxCell = htmlTableRow.createCell();
            checkBoxCell.setClasses(getRenderer().getCurricularCourseToEnrolCheckBoxClasses());

            checkBox = new HtmlCheckBox(false);
            checkBox.setName("extraCurricularEnrolments" + curricularCourse.getClass().getCanonicalName() + ":"
                    + curricularCourse.getExternalId());
            checkBox.setUserValue(curricularCourse.getClass().getCanonicalName() + ":" + curricularCourse.getExternalId());
            checkBoxCell.setBody(checkBox);
            controller.addCheckBox(checkBox);

            if (group.hasEnrolmentWithEnroledState(curricularCourse, erasmusBolonhaStudentEnrollmentBean.getExecutionPeriod())) {
                cellName.setClasses(getRenderer().getEnrolmentNameClasses());
                yearCell.setClasses(getRenderer().getEnrolmentYearClasses());
                ectsCell.setClasses(getRenderer().getEnrolmentEctsClasses());
                checkBoxCell.setClasses(getRenderer().getEnrolmentCheckBoxClasses());
View Full Code Here

        for (final CurriculumModule curriculumModule : parentGroup.getCurriculumModulesSet()) {

            if (!curriculumModule.isLeaf()) {

                if (curriculumModule.isNoCourseGroupCurriculumGroup()) {
                    final NoCourseGroupCurriculumGroup noCourseGroup = (NoCourseGroupCurriculumGroup) curriculumModule;
                    if (noCourseGroup.getNoCourseGroupCurriculumGroupType() != NoCourseGroupCurriculumGroupType.STANDALONE) {
                        continue;
                    }
                }

                groups.add((CurriculumGroup) curriculumModule);
View Full Code Here

    final public NoCourseGroupCurriculumGroup getNoCourseGroupCurriculumGroup(final NoCourseGroupCurriculumGroupType groupType) {
        return (getRoot() != null) ? getRoot().getNoCourseGroupCurriculumGroup(groupType) : null;
    }

    final public NoCourseGroupCurriculumGroup createNoCourseGroupCurriculumGroup(final NoCourseGroupCurriculumGroupType groupType) {
        final NoCourseGroupCurriculumGroup noCourseGroupCurriculumGroup = getNoCourseGroupCurriculumGroup(groupType);
        if (noCourseGroupCurriculumGroup != null) {
            throw new DomainException("error.studentCurricularPlan.already.has.noCourseGroupCurriculumGroup.with.same.groupType");
        }
        return NoCourseGroupCurriculumGroup.create(groupType, getRoot());
    }
View Full Code Here

                Collections.EMPTY_LIST, bean.getCurricularRuleLevel());
    }

    static private NoCourseGroupCurriculumGroup readOrCreateNoCourseGroupCurriculumGroup(
            final StudentCurricularPlan studentCurricularPlan, final NoCourseGroupCurriculumGroupType groupType) {
        NoCourseGroupCurriculumGroup group = studentCurricularPlan.getNoCourseGroupCurriculumGroup(groupType);
        if (group == null) {
            group = studentCurricularPlan.createNoCourseGroupCurriculumGroup(groupType);
        }
        return group;
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.studentCurriculum.NoCourseGroupCurriculumGroup

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.