Package pt.utl.ist.fenix.tools.util.excel.Spreadsheet

Examples of pt.utl.ist.fenix.tools.util.excel.Spreadsheet.Row


    public static Row reportRaidesFields(final Spreadsheet sheet, final Registration registration,
            List<Registration> registrationPath, ExecutionYear executionYear, final CycleType cycleType, final boolean concluded,
            final YearMonthDay conclusionDate, BigDecimal average, boolean graduation) {

        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


    private Spreadsheet buildReport(final Degree degree, final SortedSet<SecondCycleIndividualCandidacyProcess> name) {
        final Spreadsheet spreadsheet = new Spreadsheet(degree.getSigla(), getHeader());

        for (final SecondCycleIndividualCandidacyProcess process : name) {
            final Row row = spreadsheet.addRow();
            row.setCell(process.getPersonalDetails().getName());
            row.setCell(process.getPrecedentDegreeInformation().getConclusionGrade());
            row.setCell(process.getCandidacyProfessionalExperience());
            row.setCell(process.getPrecedentDegreeInformation().getDegreeAndInstitutionName());
            row.setCell(process.getCandidacyAffinity());
            row.setCell(process.getCandidacyDegreeNature());
            row.setCell(process.getCandidacyGrade());
            row.setCell(process.getCandidacyInterviewGrade() != null ? process.getCandidacyInterviewGrade() : " ");
            row.setCell(process.getCandidacySeriesGrade());
            if (process.isCandidacyAccepted() || process.isCandidacyRejected()) {
                row.setCell(BundleUtil.getString(Bundle.ENUMERATION, process.getCandidacyState().getQualifiedName()));
            } else {
                row.setCell(" ");
            }
        }

        return spreadsheet;
    }
View Full Code Here

    }

    private void addRow(final Spreadsheet spreadsheet, final DegreeCurricularPlan degreeCurricularPlan,
            final ExecutionCourse executionCourse, final SchoolClass schoolClass, final Shift shift, final EntryPhase phase) {
        final Row row = spreadsheet.addRow();

        row.setCell(degreeCurricularPlan.getName());
        row.setCell(schoolClass.getNome());
        row.setCell(executionCourse.getNome());
        row.setCell(shift.getNome());
        row.setCell(shift.getShiftTypesPrettyPrint());

        int capacity = shift.getLotacao() - shift.getStudentsSet().size();
        if (phase.equals(EntryPhase.FIRST_PHASE)) {
            row.setCell(String.valueOf(capacity < 0 ? capacity * -1 : capacity));
        } else {
            row.setCell(String.valueOf(capacity));
        }

        if (!phase.equals(EntryPhase.FIRST_PHASE)) {
            row.setCell(String.valueOf(shift.getStudentsSet().size()));
        }
    }
View Full Code Here

    }

    private void reportRaides(final Spreadsheet sheet, final Registration registration, List<Registration> registrationPath,
            ExecutionYear executionYear, final CycleType cycleType, final boolean concluded, final YearMonthDay conclusionDate) {

        final Row row =
                RaidesCommonReportFieldsWrapper.reportRaidesFields(sheet, registration, registrationPath, executionYear,
                        cycleType, concluded, conclusionDate, null, false);

        // Total de ECTS concluídos até ao fim do ano lectivo anterior ao que se referem os dados  no curso actual
        double totalEctsConcludedUntilPreviousYear = 0d;
        for (final CycleCurriculumGroup cycleCurriculumGroup : registration.getLastStudentCurricularPlan()
                .getInternalCycleCurriculumGrops()) {
            totalEctsConcludedUntilPreviousYear +=
                    cycleCurriculumGroup.getCreditsConcluded(executionYear.getPreviousExecutionYear());
        }

        // Total de ECTS necessários para a conclusão
        if (concluded) {
            row.setCell(0);
        } else {
            row.setCell(registration.getLastStudentCurricularPlan().getRoot().getDefaultEcts(executionYear)
                    - totalEctsConcludedUntilPreviousYear);
        }
    }
View Full Code Here

    }

    private void addEctsLabelDegreeRow(final Spreadsheet spreadsheet, final DegreeCurricularPlan degreeCurricularPlan,
            final ExecutionYear executionYear) {

        final Row row = spreadsheet.addRow();
        final Degree degree = degreeCurricularPlan.getDegree();

        row.setCell(normalize(degree.getNameFor(executionYear).getContent(MultiLanguageString.pt)));
        row.setCell(normalize(degree.getNameFor(executionYear).getContent(MultiLanguageString.en)));

        row.setCell(degree.getDegreeType().getLocalizedName());
        row.setCell(degree.getDegreeType().getYears());
        row.setCell(degree.getDegreeType().getYears() * 40);
        row.setCell(degree.getEctsCredits());

        final DegreeInfo degreeInfo = degree.getMostRecentDegreeInfo(executionYear);
        if (degreeInfo != null) {
            row.setCell(normalize(degreeInfo.getDesignedFor(MultiLanguageString.pt)));
            row.setCell(normalize(degreeInfo.getDesignedFor(MultiLanguageString.en)));
            row.setCell(normalize(degreeInfo.getObjectives(MultiLanguageString.pt)));
            row.setCell(normalize(degreeInfo.getObjectives(MultiLanguageString.en)));
            row.setCell(normalize(degreeInfo.getProfessionalExits(MultiLanguageString.pt)));
            row.setCell(normalize(degreeInfo.getProfessionalExits(MultiLanguageString.en)));
            row.setCell(normalize(degreeInfo.getOperationalRegime(MultiLanguageString.pt)));
            row.setCell(normalize(degreeInfo.getOperationalRegime(MultiLanguageString.en)));
            row.setCell(normalize(getResponsibleCoordinatorNames(degreeCurricularPlan, executionYear)));
            row.setCell(normalize(degreeInfo.getAdditionalInfo(MultiLanguageString.pt)));
            row.setCell(normalize(degreeInfo.getAdditionalInfo(MultiLanguageString.en)));
        }
    }
View Full Code Here

            spreadsheet.setHeader(evaluation.getPresentationName());
        }

        for (final Attends attends : executionCourse.getOrderedAttends()) {
            final Registration registration = attends.getRegistration();
            final Row row = spreadsheet.addRow();
            row.setCell(registration.getPerson().getUsername());
            row.setCell(registration.getNumber());
            row.setCell(registration.getName());
            row.setCell(registration.getDegree().getSigla());
            if (attends.getEnrolment() != null) {
                final EnrolmentEvaluationType enrolmentEvaluationType = attends.getEnrolmentEvaluationType();
                row.setCell(enrolmentEvaluationType.getDescription());
            } else {
                row.setCell(BundleUtil.getString(Bundle.APPLICATION, "label.attends.enrollmentState.notEnrolled"));
            }
            for (final Evaluation evaluation : evaluations) {
                final Mark mark = findMark(attends, evaluation);
                if (mark == null) {
                    row.setCell(" ");
                } else {
                    row.setCell(mark.getMark());
                }
            }
        }

        try {
View Full Code Here

            final ExecutionSemester executionSemesterForPreviousEnrolmentCount) {
        final StudentCurricularPlan studentCurricularPlan = enrolment.getStudentCurricularPlan();
        final Registration registration = studentCurricularPlan.getRegistration();
        final Student student = registration.getStudent();

        final Row row = spreadsheet.addRow();
        row.setCell(registration.getNumber());
        setDegreeCells(row, registration.getDegree());
        row.setCell(executionSemester.getSemester().toString());
        row.setCell(executionSemester.getExecutionYear().getYear());
        row.setCell(curricularCourse.getName());
        setDegreeCells(row, degree);
        row.setCell(enrolment.getEctsCredits().toString().replace('.', ','));
        row.setCell(enrolment.isApproved() ? EnrollmentState.APROVED.getDescription() : enrolment.getEnrollmentState()
                .getDescription());
        row.setCell(enrolment.getEnrolmentEvaluationType().getDescription());
        row.setCell(enrolment.getGradeValue());

        final EnrolmentEvaluation normal = enrolment.getLatestFinalNormalEnrolmentEvaluation();
        row.setCell(normal == null ? "" : normal.getGradeValue());
        final EnrolmentEvaluation special = enrolment.getLatestFinalSpecialSeasonEnrolmentEvaluation();
        row.setCell(special == null ? "" : special.getGradeValue());
        final EnrolmentEvaluation improvement = enrolment.getLatestFinalImprovementEnrolmentEvaluation();
        row.setCell(improvement == null ? "" : improvement.getGradeValue());

        row.setCell(registration.getRegistrationProtocol().getCode());
        row.setCell(countPreviousEnrolments(curricularCourse, executionSemesterForPreviousEnrolmentCount, student));
        Attends attends = null; // enrolment.getAttendsFor(executionSemester);
        for (final Attends a : enrolment.getAttendsSet()) {
            if (a.isFor(executionSemester)) {
                if (attends == null) {
                    attends = a;
View Full Code Here

            ServletOutputStream writer = response.getOutputStream();

            final Spreadsheet spreadsheet = new Spreadsheet("ControloMetodosAvaliacao");
            for (final ExecutionCourse executionCourse : (Set<ExecutionCourse>) executionCourseWithNoEvaluationMethodSearchBean
                    .getSearchResult()) {
                final Row row = spreadsheet.addRow();
                row.setCell(executionCourse.getNome());
                final StringBuilder degrees = new StringBuilder();
                for (final Degree degree : executionCourse.getDegreesSortedByDegreeName()) {
                    if (degrees.length() > 0) {
                        degrees.append(", ");
                    }
                    degrees.append(degree.getSigla());
                }
                row.setCell(degrees.toString());
                final StringBuilder responsibleTeachers = new StringBuilder();
                final StringBuilder otherTeachers = new StringBuilder();
                for (final Professorship professorship : executionCourse.getProfessorshipsSet()) {
                    final Person person = professorship.getPerson();
                    if (professorship.isResponsibleFor()) {
                        if (responsibleTeachers.length() > 0) {
                            responsibleTeachers.append(", ");
                        }
                        responsibleTeachers.append(person.getName());
                        responsibleTeachers.append(" (");
                        responsibleTeachers.append(person.getEmail());
                        responsibleTeachers.append(" )");
                    } else {
                        if (otherTeachers.length() > 0) {
                            otherTeachers.append(", ");
                        }
                        otherTeachers.append(person.getName());
                        otherTeachers.append(" (");
                        otherTeachers.append(person.getEmail());
                        otherTeachers.append(" )");
                    }
                }
                row.setCell(responsibleTeachers.toString());
                row.setCell(otherTeachers.toString());
                final StringBuilder departments = new StringBuilder();
                for (final Department department : executionCourse.getDepartments()) {
                    if (departments.length() > 0) {
                        departments.append(", ");
                    }
                    departments.append(department.getName());
                }
                row.setCell(departments.toString());
            }
            methodInvoker.export(spreadsheet, writer);

            writer.flush();
            response.flushBuffer();
View Full Code Here

    }

    private Spreadsheet generateSpreadsheet(ExternalSupervisorViewsBean bean) {
        final Spreadsheet spreadsheet = createSpreadSheet();
        for (final StudentCurricularPlan studentCurricularPlan : bean.generateAllStudentCurricularPlans()) {
            final Row row = spreadsheet.addRow();

            row.setCell(studentCurricularPlan.getPerson().getUsername());
            row.setCell(studentCurricularPlan.getRegistration().getNumber());
            row.setCell(studentCurricularPlan.getPerson().getName());
            row.setCell(studentCurricularPlan.getPerson().getInstitutionalOrDefaultEmailAddressValue());
            row.setCell(studentCurricularPlan.getPerson().getIdDocumentType().getLocalizedName());
            row.setCell(studentCurricularPlan.getPerson().getDocumentIdNumber());
            row.setCell(studentCurricularPlan.getDegree().getSigla());
            row.setCell(studentCurricularPlan.getName());
            row.setCell(studentCurricularPlan.getStartDateYearMonthDay().toString());
            row.setCell(studentCurricularPlan.getEndDate() == null ? "" : studentCurricularPlan.getEndDate().toString());
            row.setCell(studentCurricularPlan.getRegistration().getActiveStateType().getDescription());
            row.setCell(studentCurricularPlan.getRegistration().getNumberOfCurriculumEntries());
            row.setCell(studentCurricularPlan.getRegistration().getEctsCredits());
            row.setCell(getAverageInformation(studentCurricularPlan));
            row.setCell(studentCurricularPlan.getRegistration().getCurricularYear());

        }

        return spreadsheet;
    }
View Full Code Here

    }

    private Spreadsheet generateSpreadsheet(ExternalSupervisorViewsBean bean) {
        final Spreadsheet spreadsheet = createSpreadSheet();
        for (final StudentCurricularPlan studentCurricularPlan : bean.generateAllStudentCurricularPlans()) {
            final Row row = spreadsheet.addRow();

            row.setCell(studentCurricularPlan.getPerson().getUsername());
            row.setCell(studentCurricularPlan.getRegistration().getNumber());
            row.setCell(studentCurricularPlan.getPerson().getName());
            row.setCell(studentCurricularPlan.getPerson().getInstitutionalOrDefaultEmailAddressValue());
            row.setCell(studentCurricularPlan.getPerson().getIdDocumentType().getLocalizedName());
            row.setCell(studentCurricularPlan.getPerson().getDocumentIdNumber());
            row.setCell(studentCurricularPlan.getDegree().getSigla());
            row.setCell(studentCurricularPlan.getName());
            row.setCell(studentCurricularPlan.getStartDateYearMonthDay().toString());
            row.setCell(studentCurricularPlan.getEndDate() == null ? "" : studentCurricularPlan.getEndDate().toString());
            row.setCell(studentCurricularPlan.getRegistration().getActiveStateType().getDescription());
            row.setCell(studentCurricularPlan.getRegistration().getNumberOfCurriculumEntries());
            row.setCell(studentCurricularPlan.getRegistration().getEctsCredits());
            row.setCell(getAverageInformation(studentCurricularPlan));
            row.setCell(studentCurricularPlan.getRegistration().getCurricularYear());

        }

        return spreadsheet;
    }
View Full Code Here

TOP

Related Classes of pt.utl.ist.fenix.tools.util.excel.Spreadsheet.Row

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.