Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.StudentCurricularPlan


    }

    public ActionForward checkPermission(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {

        StudentCurricularPlan studentCurricularPlan = getStudentCurricularPlan(request);
        ExecutionSemester executionSemester = getExecutionPeriod(request);

        if (!hasStatute(studentCurricularPlan.getRegistration().getStudent(), executionSemester,
                studentCurricularPlan.getRegistration())) {
            if (!studentCurricularPlan.getRegistration().isSeniorStatuteApplicable(executionSemester.getExecutionYear())) {
                addActionMessage(request, "error.special.season.not.granted");
                request.setAttribute("studentCurricularPlan", studentCurricularPlan);
                request.setAttribute("executionPeriod", executionSemester);

                return mapping.findForward("showStudentEnrollmentMenu");
            }
            studentCurricularPlan.getRegistration().grantSeniorStatute(executionSemester.getExecutionYear());
        }

        request.setAttribute("action", getAction());
        request.setAttribute("bolonhaStudentEnrollmentBean", new SpecialSeasonBolonhaStudentEnrolmentBean(studentCurricularPlan,
                executionSemester));

        addDebtsWarningMessages(studentCurricularPlan.getRegistration().getStudent(), executionSemester, request);
        return mapping.findForward("showDegreeModulesToEnrol");

    }
View Full Code Here


public class StudentEnrolmentsDA extends FenixDispatchAction {

    public ActionForward prepare(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws FenixActionException {

        final StudentCurricularPlan plan = getDomainObject(request, "scpID");
        StudentEnrolmentBean studentEnrolmentBean = new StudentEnrolmentBean();
        if (plan != null) {
            studentEnrolmentBean.setStudentCurricularPlan(plan);
            studentEnrolmentBean.setExecutionPeriod(ExecutionSemester.readActualExecutionSemester());
            return showExecutionPeriodEnrolments(studentEnrolmentBean, mapping, actionForm, request, response);
View Full Code Here

    public ActionForward pickSemester(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        final Student student = getLoggedStudent(request);
        final String scpOid = request.getParameter("scpOid");
        final StudentCurricularPlan scp = FenixFramework.getDomainObject(scpOid);
        SpecialSeasonStudentEnrollmentBean bean = new SpecialSeasonStudentEnrollmentBean(student, scp);

        request.setAttribute("bean", bean);
        return mapping.findForward("showPickSCPAndSemester");
    }
View Full Code Here

         * scp.getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(
         * ExecutionYear.readCurrentExecutionYear().getPreviousExecutionYear().
         * getLastExecutionPeriod())); result = result && eval; } return result;
         */

        final StudentCurricularPlan scp = scps.iterator().next();
        scps.remove(0);
        // Any SpecialSeason enrollment period opened for this/last year will
        // count.
        return !(scp.getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(
                ExecutionYear.readCurrentExecutionYear().getFirstExecutionPeriod())
                || scp.getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(
                        ExecutionYear.readCurrentExecutionYear().getLastExecutionPeriod())
                || scp.getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(
                        ExecutionYear.readCurrentExecutionYear().getPreviousExecutionYear().getFirstExecutionPeriod()) || scp
                .getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(
                        ExecutionYear.readCurrentExecutionYear().getPreviousExecutionYear().getLastExecutionPeriod()))
                && enrollmentPeriodNotOpen(scps);

    }
View Full Code Here

        request.setAttribute("filter", (filter != null) ? filter : "null");

        List<StudentThesisInfo> result = new ArrayList<StudentThesisInfo>();
        for (CurricularCourse curricularCourse : degreeCurricularPlan.getDissertationCurricularCourses(bean.getExecutionYear())) {
            for (Enrolment enrolment : curricularCourse.getEnrolmentsByExecutionYear(bean.getExecutionYear())) {
                StudentCurricularPlan studentCurricularPlan = enrolment.getStudentCurricularPlan();

                if (studentCurricularPlan.getDegreeCurricularPlan() != degreeCurricularPlan) {
                    continue;
                }
                final Thesis thesis = enrolment.getThesis();
                if (filter != null) {
                    final ThesisPresentationState state = ThesisPresentationState.getThesisPresentationState(thesis);
View Full Code Here

        final Row row = sheet.addRow();
        final Person graduate = registration.getPerson();
        //List<Registration> registrationPath = getFullRegistrationPath(registration);
        Registration sourceRegistration = registrationPath.iterator().next();
        final PersonalInformationBean personalInformationBean = registration.getPersonalInformationBean(executionYear);
        StudentCurricularPlan lastStudentCurricularPlan = registration.getLastStudentCurricularPlan();

        // Ciclo
        row.setCell(cycleType.getDescription());

        // Concluído
        row.setCell(String.valueOf(concluded));

        // Média do Ciclo
        if (graduation) {
            row.setCell(concluded ? printBigDecimal(average.setScale(0, BigDecimal.ROUND_HALF_EVEN)) : printBigDecimal(average));
        } else {
            row.setCell(concluded ? lastStudentCurricularPlan.getCycle(cycleType).getCurriculum().getAverage().toPlainString() : "n/a");
        }

        // Data de Conclusão
        row.setCell(conclusionDate != null ? conclusionDate.toString("dd-MM-yyyy") : "");

        // Data de Início
        row.setCell(registration.getStartDate() != null ? registration.getStartDate().toString("dd-MM-yyyy") : "");

        // Nº de aluno
        row.setCell(registration.getNumber());

        // Tipo Identificação
        row.setCell(graduate.getIdDocumentType().getLocalizedName());

        // Nº de Identificação
        row.setCell(graduate.getDocumentIdNumber());

        // Dígitos de Controlo
        row.setCell(graduate.getIdentificationDocumentExtraDigitValue());

        // Versão Doc. Identificação
        row.setCell(graduate.getIdentificationDocumentSeriesNumberValue());

        // Nome
        row.setCell(registration.getName());

        // Sexo
        row.setCell(graduate.getGender().toString());

        // Data de Nascimento
        row.setCell(graduate.getDateOfBirthYearMonthDay() != null ? graduate.getDateOfBirthYearMonthDay().toString("dd-MM-yyyy") : "n/a");

        // País de Nascimento
        row.setCell(graduate.getCountryOfBirth() != null ? graduate.getCountryOfBirth().getName() : "n/a");

        // País de Nacionalidade
        row.setCell(graduate.getCountry() != null ? graduate.getCountry().getName() : "n/a");

        // Tipo Curso
        row.setCell(registration.getDegreeType().getLocalizedName());

        // Nome Curso
        row.setCell(registration.getDegree().getNameI18N().getContent());

        // Sigla Curso
        row.setCell(registration.getDegree().getSigla());

        // Ramos do currículo do aluno
        final StringBuilder majorBranches = new StringBuilder();
        final StringBuilder minorBranches = new StringBuilder();
        for (final BranchCurriculumGroup group : lastStudentCurricularPlan.getBranchCurriculumGroups()) {
            if (group.isMajor()) {
                majorBranches.append(group.getName().toString()).append(",");
            } else if (group.isMinor()) {
                minorBranches.append(group.getName().toString()).append(",");
            }
        }

        // Ramo Principal
        if (majorBranches.length() > 0) {
            row.setCell(majorBranches.deleteCharAt(majorBranches.length() - 1).toString());
        } else {
            row.setCell("");
        }

        // Ramo Secundáro
        if (minorBranches.length() > 0) {
            row.setCell(minorBranches.deleteCharAt(minorBranches.length() - 1).toString());
        } else {
            row.setCell("");
        }

        // Ano Curricular
        row.setCell(registration.getCurricularYear(executionYear));

        // Ano de Ingresso no Curso Actual
        row.setCell(sourceRegistration.getStartExecutionYear().getName());

        // Nº de anos lectivos de inscrição no Curso actual
        int numberOfEnrolmentYears = 0;
        for (Registration current : registrationPath) {
            numberOfEnrolmentYears += current.getNumberOfYearsEnrolledUntil(executionYear);
        }
        row.setCell(numberOfEnrolmentYears);

        // Último ano em que esteve inscrito
        row.setCell(registration.getLastEnrolmentExecutionYear() != null ? registration.getLastEnrolmentExecutionYear().getName() : "");

        // Regime de frequência curso: Tempo integral/Tempo Parcial
        row.setCell(registration.getRegimeType(executionYear) != null ? registration.getRegimeType(executionYear).getName() : "");

        // Tipo de Aluno (AFA, AM, ERASMUS, etc)
        row.setCell(registration.getRegistrationProtocol() != null ? registration.getRegistrationProtocol().getCode() : "");

        // Regime de Ingresso no Curso Actual (código)
        Ingression ingression = sourceRegistration.getIngression();
        if (ingression == null && sourceRegistration.getStudentCandidacy() != null) {
            ingression = sourceRegistration.getStudentCandidacy().getIngression();
        }
        row.setCell(ingression != null ? ingression.getName() : "");

        // Regime de Ingresso no Curso Actual (designação)
        row.setCell(ingression != null ? ingression.getFullDescription() : "");

        // estabelecimento do grau preced.: Instituição onde esteve
        // inscrito mas não obteve grau, (e.g: transferencias, mudanças de
        // curso...)
        row.setCell(personalInformationBean.getPrecedentInstitution() != null ? personalInformationBean.getPrecedentInstitution()
                .getName() : "");
        // curso grau preced.
        row.setCell(personalInformationBean.getPrecedentDegreeDesignation() != null ? personalInformationBean
                .getPrecedentDegreeDesignation() : "");

        // estabelec. curso habl anterior compl (se o aluno ingressou por uma via
        // diferente CNA, e deve ser IST caso o aluno tenha estado matriculado noutro curso do IST)
        row.setCell(personalInformationBean.getInstitution() != null ? personalInformationBean.getInstitution().getName() : "");

        // curso habl anterior compl (se o aluno ingressou por uma via diferente CNA, e
        // deve ser IST caso o aluno tenha estado matriculado noutro curso do IST)
        row.setCell(personalInformationBean.getDegreeDesignation());

        // nº inscrições no curso preced. (conta uma por cada ano)
        row.setCell(personalInformationBean.getNumberOfPreviousYearEnrolmentsInPrecedentDegree() != null ? personalInformationBean
                .getNumberOfPreviousYearEnrolmentsInPrecedentDegree().toString() : "");

        // Nota de Ingresso
        Double entryGrade = null;
        if (registration.getStudentCandidacy() != null) {
            entryGrade = registration.getStudentCandidacy().getEntryGrade();
        }

        row.setCell(printDouble(entryGrade));

        // Opção de Ingresso
        Integer placingOption = null;
        if (registration.getStudentCandidacy() != null) {
            placingOption = registration.getStudentCandidacy().getPlacingOption();
        }

        row.setCell(placingOption);

        // Estado Civil
        row.setCell(personalInformationBean.getMaritalStatus() != null ? personalInformationBean.getMaritalStatus().toString() : registration
                .getPerson().getMaritalStatus().toString());

        // País de Residência Permanente
        if (personalInformationBean.getCountryOfResidence() != null) {
            row.setCell(personalInformationBean.getCountryOfResidence().getName());
        } else {
            row.setCell(registration.getStudent().getPerson().getCountryOfResidence() != null ? registration.getStudent()
                    .getPerson().getCountryOfResidence().getName() : "");
        }

        // Distrito de Residência Permanente
        if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) {
            row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getDistrict().getName());
        } else {
            row.setCell(registration.getStudent().getPerson().getDistrictOfResidence());
        }

        // Concelho de Residência Permanente
        if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) {
            row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getName());
        } else {
            row.setCell(registration.getStudent().getPerson().getDistrictSubdivisionOfResidence());
        }

        // Deslocado da Residência Permanente
        if (personalInformationBean.getDislocatedFromPermanentResidence() != null) {
            row.setCell(personalInformationBean.getDislocatedFromPermanentResidence().toString());
        } else {
            row.setCell("");
        }

        // Nível de Escolaridade do Pai
        if (personalInformationBean.getFatherSchoolLevel() != null) {
            row.setCell(personalInformationBean.getFatherSchoolLevel().getName());
        } else {
            row.setCell("");
        }

        // Nível de Escolaridade da Mãe
        if (personalInformationBean.getMotherSchoolLevel() != null) {
            row.setCell(personalInformationBean.getMotherSchoolLevel().getName());
        } else {
            row.setCell("");
        }

        // Condição perante a situação na profissão/Ocupação do
        // Pai
        if (personalInformationBean.getFatherProfessionalCondition() != null) {
            row.setCell(personalInformationBean.getFatherProfessionalCondition().getName());
        } else {
            row.setCell("");
        }

        // Condição perante a situação na profissão/Ocupação da
        // Mãe
        if (personalInformationBean.getMotherProfessionalCondition() != null) {
            row.setCell(personalInformationBean.getMotherProfessionalCondition().getName());
        } else {
            row.setCell("");
        }

        // Profissão do Pai
        if (personalInformationBean.getFatherProfessionType() != null) {
            row.setCell(personalInformationBean.getFatherProfessionType().getName());
        } else {
            row.setCell("");
        }

        // Profissão da Mãe
        if (personalInformationBean.getMotherProfessionType() != null) {
            row.setCell(personalInformationBean.getMotherProfessionType().getName());
        } else {
            row.setCell("");
        }

        // Profissão do Aluno
        if (personalInformationBean.getProfessionType() != null) {
            row.setCell(personalInformationBean.getProfessionType().getName());
        } else {
            row.setCell("");
        }

        // Data preenchimento dados RAIDES
        if (personalInformationBean.getLastModifiedDate() != null) {
            DateTime dateTime = personalInformationBean.getLastModifiedDate();
            row.setCell(dateTime.getYear() + "-" + dateTime.getMonthOfYear() + "-" + dateTime.getDayOfMonth());
        } else {
            row.setCell("");
        }

        // Estatuto de Trabalhador Estudante introduzido pelo aluno
        if (personalInformationBean.getProfessionalCondition() != null) {
            row.setCell(personalInformationBean.getProfessionalCondition().getName());
        } else {
            row.setCell("");
        }

        // Estatuto de Trabalhador Estudante 1º semestre do ano a que se
        // referem
        // os dados
        boolean working1Found = false;
        for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
            if (statute.getStatuteType() == StudentStatuteType.WORKING_STUDENT
                    && statute.isValidInExecutionPeriod(executionYear.getFirstExecutionPeriod())) {
                working1Found = true;
                break;
            }
        }
        row.setCell(String.valueOf(working1Found));

        // Estatuto de Trabalhador Estudante 1º semestre do ano a que se
        // referem
        // os dados
        boolean working2Found = false;
        for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
            if (statute.getStatuteType() == StudentStatuteType.WORKING_STUDENT
                    && statute.isValidInExecutionPeriod(executionYear.getLastExecutionPeriod())) {
                working2Found = true;
                break;
            }
        }
        row.setCell(String.valueOf(working2Found));

        // Bolseiro (info. RAIDES)
        if (personalInformationBean.getGrantOwnerType() != null) {
            row.setCell(personalInformationBean.getGrantOwnerType().getName());
        } else {
            row.setCell("");
        }

        // Instituição que atribuiu a bolsa
        if (personalInformationBean.getGrantOwnerType() != null
                && personalInformationBean.getGrantOwnerType().equals(GrantOwnerType.OTHER_INSTITUTION_GRANT_OWNER)) {
            row.setCell(personalInformationBean.getGrantOwnerProviderName());
        } else {
            row.setCell("");
        }

        // Bolseiro (info. oficial)
        boolean sasFound = false;
        for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
            if (statute.getStatuteType() == StudentStatuteType.SAS_GRANT_OWNER
                    && statute.isValidInExecutionPeriod(executionYear.getFirstExecutionPeriod())) {
                sasFound = true;
                break;
            }
        }
        row.setCell(String.valueOf(sasFound));

        // Grau Precedente
        row.setCell(personalInformationBean.getPrecedentSchoolLevel() != null ? personalInformationBean.getPrecedentSchoolLevel()
                .getName() : "");

        // Outro Grau Precedente
        row.setCell(personalInformationBean.getOtherPrecedentSchoolLevel());

        // grau da habl anterior compl
        row.setCell(personalInformationBean.getSchoolLevel() != null ? personalInformationBean.getSchoolLevel().getName() : "");

        // Codigo do grau habl anterior
        DegreeDesignation designation =
                DegreeDesignation.readByNameAndSchoolLevel(personalInformationBean.getDegreeDesignation(),
                        personalInformationBean.getPrecedentSchoolLevel());
        row.setCell(designation != null ? designation.getDegreeClassification().getCode() : "");

        // Outro grau da habl anterior compl
        row.setCell(personalInformationBean.getOtherSchoolLevel());

        // País de Habilitação Anterior ao Curso Actual
        row.setCell(personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree() != null ? personalInformationBean
                .getCountryWhereFinishedPreviousCompleteDegree().getName() : "");

        // País de Habilitação do 12º ano ou equivalente
        row.setCell(personalInformationBean.getCountryWhereFinishedHighSchoolLevel() != null ? personalInformationBean
                .getCountryWhereFinishedHighSchoolLevel().getName() : "");

        // Ano de conclusão da habilitação anterior
        row.setCell(personalInformationBean.getConclusionYear());

        // Nota de conclusão da habilitação anterior
        row.setCell(personalInformationBean.getConclusionGrade() != null ? personalInformationBean.getConclusionGrade() : "");

        MobilityAgreement mobilityAgreement = null;
        ExecutionInterval chosenCandidacyInterval = null;
        //getting the last mobility program done
        for (OutboundMobilityCandidacySubmission outboundCandidacySubmission : registration
                .getOutboundMobilityCandidacySubmissionSet()) {
            if (outboundCandidacySubmission.getSelectedCandidacy() != null
                    && outboundCandidacySubmission.getSelectedCandidacy().getSelected()) {
                ExecutionInterval candidacyInterval =
                        outboundCandidacySubmission.getOutboundMobilityCandidacyPeriod().getExecutionInterval();
                //the candidacies are made in the previous year
                if (candidacyInterval.getAcademicInterval().isBefore(executionYear.getAcademicInterval())) {
                    if (mobilityAgreement != null) {
                        if (!candidacyInterval.getAcademicInterval().isAfter(chosenCandidacyInterval.getAcademicInterval())) {
                            continue;
                        }
                    }
                    mobilityAgreement =
                            outboundCandidacySubmission.getSelectedCandidacy().getOutboundMobilityCandidacyContest()
                                    .getMobilityAgreement();
                    chosenCandidacyInterval = candidacyInterval;
                }
            }
        }
        // Programa de mobilidade
        row.setCell(mobilityAgreement != null ? mobilityAgreement.getMobilityProgram().getName().getContent() : "");

        // País de mobilidade
        row.setCell(mobilityAgreement != null ? mobilityAgreement.getUniversityUnit().getCountry().getName() : "");

        // Duração do programa de mobilidade
        row.setCell(personalInformationBean.getMobilityProgramDuration() != null ? BundleUtil.getString(Bundle.ENUMERATION,
                personalInformationBean.getMobilityProgramDuration().name()) : "");

        // Tipo de Estabelecimento Frequentado no Ensino Secundário
        if (personalInformationBean.getHighSchoolType() != null) {
            row.setCell(personalInformationBean.getHighSchoolType().getName());
        } else {
            row.setCell("");
        }

        int totalEnrolmentsInPreviousYear = 0;
        int totalEnrolmentsApprovedInPreviousYear = 0;
        //int totalEnrolmentsInFirstSemester = 0;
        double totalEctsConcludedUntilPreviousYear = 0d;
        for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan.getInternalCycleCurriculumGrops()) {

            totalEctsConcludedUntilPreviousYear +=
                    cycleCurriculumGroup.getCreditsConcluded(executionYear.getPreviousExecutionYear());

            totalEnrolmentsInPreviousYear +=
                    cycleCurriculumGroup.getEnrolmentsBy(executionYear.getPreviousExecutionYear()).size();

            for (final Enrolment enrolment : cycleCurriculumGroup.getEnrolmentsBy(executionYear.getPreviousExecutionYear())) {
                if (enrolment.isApproved()) {
                    totalEnrolmentsApprovedInPreviousYear++;
                }
            }

            //      totalEnrolmentsInFirstSemester += cycleCurriculumGroup.getEnrolmentsBy(executionYear.getFirstExecutionPeriod())
            //        .size();
        }

        // Total de ECTS inscritos no total do ano
        double totalCreditsEnrolled = 0d;
        for (Enrolment enrollment : lastStudentCurricularPlan.getEnrolmentsByExecutionYear(executionYear)) {
            totalCreditsEnrolled += enrollment.getEctsCredits();
        }
        row.setCell(printDouble(totalCreditsEnrolled));

        // Total de ECTS concluídos até ao fim do ano lectivo anterior ao
        // que se
        // referem os dados (neste caso até ao fim de 2007/08) no curso actual
        double totalCreditsDismissed = 0d;
        for (Credits credits : lastStudentCurricularPlan.getCreditsSet()) {
            if (credits.isEquivalence()) {
                totalCreditsDismissed += credits.getEnrolmentsEcts();
            }
        }
        row.setCell(printDouble(totalEctsConcludedUntilPreviousYear));

        // Nº de Disciplinas Inscritos no ano lectivo anterior ao que se
        // referem
        // os dados
        row.setCell(totalEnrolmentsInPreviousYear);

        // Nº de Disciplinas Aprovadas no ano lectivo anterior ao que se
        // referem
        // os dados
        row.setCell(totalEnrolmentsApprovedInPreviousYear);

        // Nº de Inscrições Externas no ano a que se referem os dados
        ExtraCurriculumGroup extraCurriculumGroup = lastStudentCurricularPlan.getExtraCurriculumGroup();
        int extraCurricularEnrolmentsCount =
                extraCurriculumGroup != null ? extraCurriculumGroup.getEnrolmentsBy(executionYear).size() : 0;

        for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan.getExternalCurriculumGroups()) {
            extraCurricularEnrolmentsCount += cycleCurriculumGroup.getEnrolmentsBy(executionYear).size();
        }

        if (lastStudentCurricularPlan.hasPropaedeuticsCurriculumGroup()) {
            extraCurricularEnrolmentsCount +=
                    lastStudentCurricularPlan.getPropaedeuticCurriculumGroup().getEnrolmentsBy(executionYear).size();
        }

        row.setCell(extraCurricularEnrolmentsCount);

        // Estados de matrícula
        SortedSet<RegistrationState> states = new TreeSet<RegistrationState>(RegistrationState.DATE_COMPARATOR);
        for (Registration current : registrationPath) {
            states.addAll(current.getRegistrationStatesSet());
        }
        RegistrationState previousYearState = null;
        RegistrationState currentYearState = null;
        for (RegistrationState state : states) {
            if (!state.getStateDate().isAfter(
                    executionYear.getPreviousExecutionYear().getEndDateYearMonthDay().toDateTimeAtMidnight())) {
                previousYearState = state;
            }
            if (!state.getStateDate().isAfter(executionYear.getEndDateYearMonthDay().toDateTimeAtMidnight())) {
                currentYearState = state;
            }
        }

        // Estado da matrícula no ano lectivo anterior ao que se referem os
        // dados
        row.setCell(previousYearState != null ? previousYearState.getStateType().getDescription() : "n/a");

        // Estado (da matrícula) no ano a que se referem os dados
        row.setCell(currentYearState != null ? currentYearState.getStateType().getDescription() : "n/a");

        // Data do estado de matrícula
        row.setCell(currentYearState != null ? currentYearState.getStateDate().toString("dd-MM-yyyy") : "n/a");

        // Nº ECTS do 1º Ciclo concluídos até ao fim do ano lectivo
        // anterior ao que se referem os dados
        final CycleCurriculumGroup firstCycleCurriculumGroup =
                lastStudentCurricularPlan.getRoot().getCycleCurriculumGroup(CycleType.FIRST_CYCLE);
        row.setCell(firstCycleCurriculumGroup != null ? printBigDecimal(firstCycleCurriculumGroup.getCurriculum(executionYear)
                .getSumEctsCredits()) : "");

        // Nº ECTS do 2º Ciclo concluídos até ao fim do ano lectivo
        // anterior ao que se referem os dados
        final CycleCurriculumGroup secondCycleCurriculumGroup =
                lastStudentCurricularPlan.getRoot().getCycleCurriculumGroup(CycleType.SECOND_CYCLE);
        row.setCell(secondCycleCurriculumGroup != null && !secondCycleCurriculumGroup.isExternal() ? printBigDecimal(secondCycleCurriculumGroup
                .getCurriculum(executionYear).getSumEctsCredits()) : "");

        // Nº ECTS do 2º Ciclo Extra primeiro ciclo concluídos até ao fim do ano
        // lectivo anterior ao que se referem os dados
        Double extraFirstCycleEcts = 0d;
        for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan.getExternalCurriculumGroups()) {
            for (final CurriculumLine curriculumLine : cycleCurriculumGroup.getAllCurriculumLines()) {
                if (!curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                    extraFirstCycleEcts += curriculumLine.getCreditsConcluded(executionYear.getPreviousExecutionYear());
                }
            }
        }
        row.setCell(printDouble(extraFirstCycleEcts));

        // Nº ECTS Extracurriculares concluídos até ao fim do ano lectivo
        // anterior que ao se referem os dados
        Double extraCurricularEcts = 0d;
        Double allExtraCurricularEcts = 0d;
        if (extraCurriculumGroup != null) {
            for (final CurriculumLine curriculumLine : extraCurriculumGroup.getAllCurriculumLines()) {
                if (curriculumLine.isApproved() && curriculumLine.hasExecutionPeriod()
                        && !curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                    extraCurricularEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
                }
                if (curriculumLine.hasExecutionPeriod() && curriculumLine.getExecutionYear() == executionYear) {
                    allExtraCurricularEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
                }
            }
        }
        row.setCell(printDouble(extraCurricularEcts));

        // Nº ECTS Propedeutic concluídos até ao fim do ano lectivo
        // anterior que ao se referem os dados
        Double propaedeuticEcts = 0d;
        Double allPropaedeuticEcts = 0d;
        if (lastStudentCurricularPlan.getPropaedeuticCurriculumGroup() != null) {
            for (final CurriculumLine curriculumLine : lastStudentCurricularPlan.getPropaedeuticCurriculumGroup()
                    .getAllCurriculumLines()) {
                if (curriculumLine.isApproved() && curriculumLine.hasExecutionPeriod()
                        && !curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                    propaedeuticEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
                }
                if (curriculumLine.hasExecutionPeriod() && curriculumLine.getExecutionYear() == executionYear) {
                    allPropaedeuticEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
                }
            }
        }
        row.setCell(printDouble(propaedeuticEcts));

        // Nº ECTS inscritos em unidades curriculares propedêuticas e em
        // extra-curriculares
        row.setCell(printDouble(allPropaedeuticEcts + allExtraCurricularEcts));

        // Nº ECTS equivalência/substituição/dispensa
        row.setCell(printDouble(totalCreditsDismissed));

        // Tem situação de propinas no lectivo dos dados
        row.setCell(String.valueOf(lastStudentCurricularPlan.hasAnyGratuityEventFor(executionYear)));

        return row;
    }
View Full Code Here

        }

        final List<StudentCurricularPlan> studentCurricularPlans = new ArrayList<StudentCurricularPlan>();
        for (final Registration registration : student.getRegistrationsSet()) {
            if (registration.isBolonha()) {
                final StudentCurricularPlan studentCurricularPlan = registration.getLastStudentCurricularPlan();

                for (final CycleType cycleType : getValidPrecedentCycleTypes()) {

                    if (studentCurricularPlan.hasCycleCurriculumGroup(cycleType)) {
                        final CycleCurriculumGroup cycle = studentCurricularPlan.getCycle(cycleType);

                        // not concluded cycles count if respect minimum ects
                        if (cycle.isConclusionProcessed() || cycle.isConcluded()
                                || cycle.getCreditsConcluded().doubleValue() >= getMinimumEcts(cycleType)) {
                            studentCurricularPlans.add(registration.getLastStudentCurricularPlan());
View Full Code Here

            addActionMessage("error", request, ex.getKey(), ex.getArgs());

            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);
            }
        }
        MobilityIndividualApplicationProcess process = getProcess(request);
View Full Code Here

    private static Predicate<Registration> getPredicateForActiveRegistrationsThatHaveAtLeastOneEnrolment(
            final CycleType cycleType, final ExecutionYear executionYear) {
        return new Predicate<Registration>() {
            @Override
            public boolean apply(Registration registration) {
                StudentCurricularPlan studentCurricularPlan = registration.getStudentCurricularPlan(executionYear);
                if (studentCurricularPlan != null && !studentCurricularPlan.hasConcludedCycle(cycleType, executionYear)) {
                    CycleCurriculumGroup cycleCurriculumGroup = studentCurricularPlan.getCycle(cycleType);
                    if (cycleCurriculumGroup != null
                            && cycleCurriculumGroup.isConcluded(executionYear).equals(ConclusionValue.NOT_CONCLUDED)
                            && cycleCurriculumGroup.hasAnyEnrolments()) {
                        return true;
                    }
View Full Code Here

            pdi.setNumberOfEnrolmentsInPreviousDegrees(candidacyProcessWithPDIBean
                    .getNumberOfPreviousYearEnrolmentsInPrecedentDegree());
            pdi.setCandidacyInternal(false);
        } else {
            pdi.setCandidacyInternal(true);
            final StudentCurricularPlan studentCurricularPlan = candidacyProcessWithPDIBean.getPrecedentStudentCurricularPlan();

            if (studentCurricularPlan == null) {
                throw new DomainException("error.IndividualCandidacy.invalid.precedentDegreeInformation");
            }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.StudentCurricularPlan

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.