List of usage examples for org.joda.time DateTime getYear
public int getYear()
From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.CreateUnavailablePeriod.java
License:Open Source License
private static void sendEmail(Person person, DateTime begin, DateTime end, String justification, List<VigilantGroup> groups) { for (VigilantGroup group : groups) { String bccs = group.getContactEmail(); String beginDate = begin.getDayOfMonth() + "/" + begin.getMonthOfYear() + "/" + begin.getYear() + " - " + String.format("%02d", begin.getHourOfDay()) + ":" + String.format("%02d", begin.getMinuteOfHour()) + "h"; String endDate = end.getDayOfMonth() + "/" + end.getMonthOfYear() + "/" + end.getYear() + " - " + String.format("%02d", end.getHourOfDay()) + ":" + String.format("%02d", end.getMinuteOfHour()) + "h"; ;/* w ww . j a v a 2s . co m*/ String message = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod", new String[] { person.getName(), beginDate, endDate, justification }); String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod.subject", new String[] { group.getName() }); Sender sender = Bennu.getInstance().getSystemSender(); new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(), Collections.EMPTY_LIST, subject, message, bccs); } }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.resourceAllocationManager.exams.DeleteWrittenEvaluation.java
License:Open Source License
private void notifyVigilants(WrittenEvaluation writtenEvaluation) { final Set<Person> tos = new HashSet<Person>(); for (VigilantGroup group : writtenEvaluation.getAssociatedVigilantGroups()) { tos.clear();//from w ww .jav a2 s .c om DateTime date = writtenEvaluation.getBeginningDateTime(); String time = writtenEvaluation.getBeginningDateHourMinuteSecond().toString(); String beginDateString = date.getDayOfMonth() + "-" + date.getMonthOfYear() + "-" + date.getYear(); String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.subject", new String[] { writtenEvaluation.getName(), group.getName(), beginDateString, time }); String body = BundleUtil.getString(Bundle.VIGILANCY, "label.writtenEvaluationDeletedMessage", new String[] { writtenEvaluation.getName(), beginDateString, time }); for (Vigilancy vigilancy : writtenEvaluation.getVigilanciesSet()) { Person person = vigilancy.getVigilantWrapper().getPerson(); tos.add(person); } Sender sender = Bennu.getInstance().getSystemSender(); new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(), new Recipient(UserGroup.of(Person.convertToUsers(tos))).asCollection(), subject, body, ""); } }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.resourceAllocationManager.exams.EditWrittenEvaluation.java
License:Open Source License
private void notifyVigilants(WrittenEvaluation writtenEvaluation, Date dayDate, Date beginDate) { final HashSet<Person> tos = new HashSet<Person>(); // VigilantGroup group = // writtenEvaluation.getAssociatedVigilantGroups().iterator().next(); for (VigilantGroup group : writtenEvaluation.getAssociatedVigilantGroups()) { tos.clear();//from ww w . ja va2s . co m DateTime date = writtenEvaluation.getBeginningDateTime(); String time = writtenEvaluation.getBeginningDateHourMinuteSecond().toString(); String beginDateString = date.getDayOfMonth() + "-" + date.getMonthOfYear() + "-" + date.getYear(); String subject = String.format("[ %s - %s - %s %s ]", new Object[] { writtenEvaluation.getName(), group.getName(), beginDateString, time }); String body = String.format( "Caro Vigilante,\n\nA prova de avaliao: %1$s %2$s - %3$s foi alterada para %4$td-%4$tm-%4$tY - %5$tH:%5$tM.", new Object[] { writtenEvaluation.getName(), beginDateString, time, dayDate, beginDate }); for (Vigilancy vigilancy : writtenEvaluation.getVigilanciesSet()) { Person person = vigilancy.getVigilantWrapper().getPerson(); tos.add(person); } Sender sender = Bennu.getInstance().getSystemSender(); new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(), new Recipient(UserGroup.of(Person.convertToUsers(tos))).asCollection(), subject, body, ""); } }
From source file:net.sourceforge.fenixedu.domain.onlineTests.StudentTestLog.java
License:Open Source License
public static String getChecksum(DistributedTest distributedTest, Registration student, DateTime dateTime) { StringBuilder checksumCode = new StringBuilder(); checksumCode.append(student.getNumber()); checksumCode.append(distributedTest.getExternalId()); final DateTime thisDateTime = new DateTime(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute(), 0); checksumCode.append(thisDateTime.getMillis()); checksumCode.append(Bennu.getInstance().getTestChecksumsSet().iterator().next().getChecksumCode()); return (Hashing.sha1().hashString(checksumCode.toString(), Charsets.UTF_8)).toString(); }
From source file:net.sourceforge.fenixedu.domain.phd.debts.PhdGratuityPaymentPeriod.java
License:Open Source License
public Money fine(double fineRate, Money amount, DateTime when) { LocalDate whenPaying = new LocalDate(when.getYear(), when.monthOfYear().get(), when.dayOfMonth().get()); LocalDate lastPaymentDay = new LocalDate(when.getYear(), getMonthLastPayment(), getDayLastPayment()); if (whenPaying.isAfter(lastPaymentDay)) { int monthsOut = when.getMonthOfYear() - lastPaymentDay.getMonthOfYear(); // if is in the same month, and a day has passed, at least it // counts for one month if (monthsOut == 0) { monthsOut = 1;// ww w .j av a 2 s . c o m } return new Money(amount.getAmount().multiply(new BigDecimal(fineRate * monthsOut))); } else { return new Money(0); } }
From source file:net.sourceforge.fenixedu.domain.reports.RaidesCommonReportFieldsWrapper.java
License:Open Source License
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/*w ww . j ava 2 s . c o m*/ row.setCell(cycleType.getDescription()); // Concludo row.setCell(String.valueOf(concluded)); // Mdia 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 Concluso row.setCell(conclusionDate != null ? conclusionDate.toString("dd-MM-yyyy") : ""); // Data de Incio row.setCell(registration.getStartDate() != null ? registration.getStartDate().toString("dd-MM-yyyy") : ""); // N de aluno row.setCell(registration.getNumber()); // Tipo Identificao row.setCell(graduate.getIdDocumentType().getLocalizedName()); // N de Identificao row.setCell(graduate.getDocumentIdNumber()); // Dgitos de Controlo row.setCell(graduate.getIdentificationDocumentExtraDigitValue()); // Verso Doc. Identificao 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"); // Pas de Nascimento row.setCell(graduate.getCountryOfBirth() != null ? graduate.getCountryOfBirth().getName() : "n/a"); // Pas 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 currculo 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 Secundro 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 inscrio 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 frequncia 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 (cdigo) 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 (designao) row.setCell(ingression != null ? ingression.getFullDescription() : ""); // estabelecimento do grau preced.: Instituio onde esteve // inscrito mas no obteve grau, (e.g: transferencias, mudanas 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 inscries 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)); // Opo 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()); // Pas de Residncia 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 Residncia Permanente if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) { row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getDistrict().getName()); } else { row.setCell(registration.getStudent().getPerson().getDistrictOfResidence()); } // Concelho de Residncia Permanente if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) { row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getName()); } else { row.setCell(registration.getStudent().getPerson().getDistrictSubdivisionOfResidence()); } // Deslocado da Residncia Permanente if (personalInformationBean.getDislocatedFromPermanentResidence() != null) { row.setCell(personalInformationBean.getDislocatedFromPermanentResidence().toString()); } else { row.setCell(""); } // Nvel de Escolaridade do Pai if (personalInformationBean.getFatherSchoolLevel() != null) { row.setCell(personalInformationBean.getFatherSchoolLevel().getName()); } else { row.setCell(""); } // Nvel de Escolaridade da Me if (personalInformationBean.getMotherSchoolLevel() != null) { row.setCell(personalInformationBean.getMotherSchoolLevel().getName()); } else { row.setCell(""); } // Condio perante a situao na profisso/Ocupao do // Pai if (personalInformationBean.getFatherProfessionalCondition() != null) { row.setCell(personalInformationBean.getFatherProfessionalCondition().getName()); } else { row.setCell(""); } // Condio perante a situao na profisso/Ocupao da // Me if (personalInformationBean.getMotherProfessionalCondition() != null) { row.setCell(personalInformationBean.getMotherProfessionalCondition().getName()); } else { row.setCell(""); } // Profisso do Pai if (personalInformationBean.getFatherProfessionType() != null) { row.setCell(personalInformationBean.getFatherProfessionType().getName()); } else { row.setCell(""); } // Profisso da Me if (personalInformationBean.getMotherProfessionType() != null) { row.setCell(personalInformationBean.getMotherProfessionType().getName()); } else { row.setCell(""); } // Profisso 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(""); } // Instituio 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()); // Pas de Habilitao Anterior ao Curso Actual row.setCell(personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree() != null ? personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree().getName() : ""); // Pas de Habilitao do 12 ano ou equivalente row.setCell(personalInformationBean.getCountryWhereFinishedHighSchoolLevel() != null ? personalInformationBean.getCountryWhereFinishedHighSchoolLevel().getName() : ""); // Ano de concluso da habilitao anterior row.setCell(personalInformationBean.getConclusionYear()); // Nota de concluso da habilitao 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() : ""); // Pas de mobilidade row.setCell(mobilityAgreement != null ? mobilityAgreement.getUniversityUnit().getCountry().getName() : ""); // Durao do programa de mobilidade row.setCell(personalInformationBean.getMobilityProgramDuration() != null ? BundleUtil .getString(Bundle.ENUMERATION, personalInformationBean.getMobilityProgramDuration().name()) : ""); // Tipo de Estabelecimento Frequentado no Ensino Secundrio 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 concludos 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 Inscries 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 matrcula 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 matrcula no ano lectivo anterior ao que se referem os // dados row.setCell(previousYearState != null ? previousYearState.getStateType().getDescription() : "n/a"); // Estado (da matrcula) no ano a que se referem os dados row.setCell(currentYearState != null ? currentYearState.getStateType().getDescription() : "n/a"); // Data do estado de matrcula row.setCell(currentYearState != null ? currentYearState.getStateDate().toString("dd-MM-yyyy") : "n/a"); // N ECTS do 1 Ciclo concludos 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 concludos 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 concludos 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 concludos 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 concludos 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 propeduticas e em // extra-curriculares row.setCell(printDouble(allPropaedeuticEcts + allExtraCurricularEcts)); // N ECTS equivalncia/substituio/dispensa row.setCell(printDouble(totalCreditsDismissed)); // Tem situao de propinas no lectivo dos dados row.setCell(String.valueOf(lastStudentCurricularPlan.hasAnyGratuityEventFor(executionYear))); return row; }
From source file:net.sourceforge.fenixedu.domain.reports.RaidesPhdReportFile.java
License:Open Source License
private void reportRaidesGraduate(Spreadsheet spreadsheet, PhdIndividualProgramProcess process, ExecutionYear executionYear) {/*from w w w. j av a 2 s . c om*/ final Row row = spreadsheet.addRow(); final Person graduate = process.getPerson(); final PersonalInformationBean personalInformationBean = process.getPersonalInformationBean(executionYear); final Registration registration = process.getRegistration(); final boolean concluded = process.isConcluded(); final LocalDate conclusionDate = process.getConclusionDate(); if (registration != null && !registration.isBolonha()) { return; } YearMonthDay registrationConclusionDate = registration != null ? registration.getLastStudentCurricularPlan().getCycle(CycleType.THIRD_CYCLE).getConclusionDate() : null; if (registration != null && registrationConclusionDate == null) { registrationConclusionDate = registration.getLastStudentCurricularPlan() .calculateConclusionDate(CycleType.THIRD_CYCLE); } row.setCell(String.valueOf(registration != null && !registration.isCanceled())); // Ciclo row.setCell(CycleType.THIRD_CYCLE.getDescription()); // Concludo row.setCell(String.valueOf(process.isConcluded())); // Mdia do Ciclo String grade = concluded ? process.getFinalGrade().getLocalizedName() : "n/a"; if (concluded && registration != null && registration.isConcluded()) { grade += " " + registration.getLastStudentCurricularPlan().getCycle(CycleType.THIRD_CYCLE) .getCurriculum(registrationConclusionDate.toDateTimeAtMidnight()).getAverage().toPlainString(); } row.setCell(grade); // Data de concluso row.setCell(conclusionDate != null ? conclusionDate.toString("dd-MM-yyyy") : ""); // Data de Incio row.setCell(process.getCandidacyDate().toString("dd-MM-yyyy")); // N de aluno row.setCell(process.getStudent().getNumber()); // Tipo Identificao row.setCell(graduate.getIdDocumentType().getLocalizedName()); // N de Identificao row.setCell(graduate.getDocumentIdNumber()); // Dgitos de Controlo row.setCell(graduate.getIdentificationDocumentExtraDigitValue()); // Verso Doc. Identificao row.setCell(graduate.getIdentificationDocumentSeriesNumberValue()); // Nome row.setCell(registration != null ? registration.getName() : process.getPerson() != null ? process.getPerson().getName() : "n/a"); // Sexo row.setCell(graduate.getGender().toString()); // Data de Nascimento row.setCell(graduate.getDateOfBirthYearMonthDay() != null ? graduate.getDateOfBirthYearMonthDay().toString("dd-MM-yyyy") : "n/a"); // Pas de Nascimento row.setCell(graduate.getCountryOfBirth() != null ? graduate.getCountryOfBirth().getName() : "n/a"); // Pas de Nacionalidade row.setCell(graduate.getCountry() != null ? graduate.getCountry().getName() : "n/a"); // Sigla programa doutoral row.setCell(process.getPhdProgram().getAcronym()); // Programa doutoral row.setCell(process.getPhdProgram().getName().getContent()); // Tipo Curso row.setCell(registration != null ? registration.getDegreeType().getLocalizedName() : "n/a"); // Nome Curso row.setCell(registration != null ? registration.getDegree().getNameI18N().getContent() : "n/a"); // Sigla Curso row.setCell(registration != null ? registration.getDegree().getSigla() : "n/a"); // Ramo (caso se aplique) row.setCell("no determinvel"); if (registration != null) { // N de anos lectivos de inscrio no Curso actual row.setCell(calculateNumberOfEnrolmentYears(registration, executionYear)); // ltimo ano em que esteve inscrito row.setCell(registration.getLastEnrolmentExecutionYear() != null ? registration.getLastEnrolmentExecutionYear().getName() : ""); } else { row.setCell("n/a"); row.setCell("n/a"); } // estabelecimento do 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()); // Estado Civil row.setCell(personalInformationBean.getMaritalStatus() != null ? personalInformationBean.getMaritalStatus().toString() : process.getPerson().getMaritalStatus().toString()); // Pas de Residncia Permanente if (personalInformationBean.getCountryOfResidence() != null) { row.setCell(personalInformationBean.getCountryOfResidence().getName()); } else { row.setCell(process.getStudent().getPerson().getCountryOfResidence() != null ? process.getStudent().getPerson().getCountryOfResidence().getName() : ""); } // Distrito de Residncia Permanente if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) { row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getDistrict().getName()); } else { row.setCell(process.getStudent().getPerson().getDistrictOfResidence()); } // Concelho de Residncia Permanente if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) { row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getName()); } else { row.setCell(process.getStudent().getPerson().getDistrictSubdivisionOfResidence()); } // Deslocado da Residncia Permanente if (personalInformationBean.getDislocatedFromPermanentResidence() != null) { row.setCell(personalInformationBean.getDislocatedFromPermanentResidence().toString()); } else { row.setCell(""); } // Nvel de Escolaridade do Pai if (personalInformationBean.getFatherSchoolLevel() != null) { row.setCell(personalInformationBean.getFatherSchoolLevel().getName()); } else { row.setCell(""); } // Nvel de Escolaridade da Me if (personalInformationBean.getMotherSchoolLevel() != null) { row.setCell(personalInformationBean.getMotherSchoolLevel().getName()); } else { row.setCell(""); } // Condio perante a situao na profisso/Ocupao do Pai if (personalInformationBean.getFatherProfessionalCondition() != null) { row.setCell(personalInformationBean.getFatherProfessionalCondition().getName()); } else { row.setCell(""); } // Condio perante a situao na profisso/Ocupao da Me if (personalInformationBean.getMotherProfessionalCondition() != null) { row.setCell(personalInformationBean.getMotherProfessionalCondition().getName()); } else { row.setCell(""); } // Profisso do Pai if (personalInformationBean.getFatherProfessionType() != null) { row.setCell(personalInformationBean.getFatherProfessionType().getName()); } else { row.setCell(""); } // Profisso da Me if (personalInformationBean.getMotherProfessionType() != null) { row.setCell(personalInformationBean.getMotherProfessionType().getName()); } else { row.setCell(""); } // Profisso 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(""); } // Bolseiro (info. RAIDES) if (personalInformationBean.getGrantOwnerType() != null) { row.setCell(personalInformationBean.getGrantOwnerType().getName()); } else { row.setCell(""); } // Bolseiro (info. oficial) boolean sasFound = false; for (StudentStatute statute : process.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() : ""); // grau habl anterior compl row.setCell(personalInformationBean.getSchoolLevel() != null ? personalInformationBean.getSchoolLevel().getName() : ""); // outro grau habl anterior compl row.setCell(personalInformationBean.getOtherSchoolLevel() != null ? personalInformationBean.getOtherSchoolLevel() : ""); // Pas de Habilitao Anterior Completa row.setCell(personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree() != null ? personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree().getName() : ""); // Pas de Habilitao do 12 ano ou equivalente row.setCell(personalInformationBean.getCountryWhereFinishedHighSchoolLevel() != null ? personalInformationBean.getCountryWhereFinishedHighSchoolLevel().getName() : ""); // Ano de concluso da habilitao anterior completa row.setCell(personalInformationBean.getConclusionYear()); // Nota de concluso da habilitao anterior completa row.setCell( personalInformationBean.getConclusionGrade() != null ? personalInformationBean.getConclusionGrade() : ""); // N inscries no curso preced. (conta uma por cada ano) row.setCell(personalInformationBean.getNumberOfPreviousYearEnrolmentsInPrecedentDegree() != null ? personalInformationBean.getNumberOfPreviousYearEnrolmentsInPrecedentDegree().toString() : ""); // Durao do programa de mobilidade row.setCell(personalInformationBean.getMobilityProgramDuration() != null ? BundleUtil .getString(Bundle.ENUMERATION, personalInformationBean.getMobilityProgramDuration().name()) : ""); // Tipo de Estabelecimento Frequentado no Ensino Secundrio if (personalInformationBean.getHighSchoolType() != null) { row.setCell(personalInformationBean.getHighSchoolType().getName()); } else { row.setCell(""); } double totalEctsConcludedUntilPreviousYear = 0d; if (registration != null) { // Total de ECTS inscritos no total do ano double totalCreditsEnrolled = 0d; for (Enrolment enrollment : registration.getLastStudentCurricularPlan() .getEnrolmentsByExecutionYear(executionYear)) { totalCreditsEnrolled += enrollment.getEctsCredits(); } row.setCell(totalCreditsEnrolled); // Total de ECTS concludos at ao fim do ano lectivo anterior (1 // Semestre do ano lectivo actual) ao que se // referem os dados (neste caso at ao fim de 2008) no curso actual for (final CycleCurriculumGroup cycleCurriculumGroup : registration.getLastStudentCurricularPlan() .getInternalCycleCurriculumGrops()) { // We can use current year because only the first semester has // occured totalEctsConcludedUntilPreviousYear += cycleCurriculumGroup.getCreditsConcluded(executionYear); } row.setCell(totalEctsConcludedUntilPreviousYear); // N ECTS equivalncia/substituio/dispensa double totalCreditsDismissed = 0d; for (Credits credits : registration.getLastStudentCurricularPlan().getCreditsSet()) { if (credits.isEquivalence()) { totalCreditsDismissed += credits.getEnrolmentsEcts(); } } row.setCell(totalCreditsDismissed); } else { row.setCell("n/a"); row.setCell("n/a"); row.setCell("n/a"); } if (registration != null) { // Total de ECTS necessrios para a concluso if (concluded) { row.setCell(0); } else { row.setCell(registration.getLastStudentCurricularPlan().getRoot().getDefaultEcts(executionYear) - totalEctsConcludedUntilPreviousYear); } } else { row.setCell("n/a"); } // Se alunos de Doutoramento, inscrito na Parte Curricular? if (registration != null && registration.isDEA()) { row.setCell(String.valueOf(registration.getLastStudentCurricularPlan().hasEnrolments(executionYear))); } else { row.setCell("not PhD"); } row.setCell(process.getPhdStudentNumber()); // ist id dos orientadores int count = 0; StringBuilder guidings = new StringBuilder(); for (PhdParticipant phdParticipant : process.getGuidingsSet()) { if (phdParticipant.isInternal()) { if (count > 0) { guidings.append(";"); } guidings.append(((InternalPhdParticipant) phdParticipant).getPerson().getIstUsername()); count++; } } row.setCell(guidings.toString()); // ist id dos co-orientadores int countAssistantGuidings = 0; StringBuilder assistantGuidings = new StringBuilder(); for (PhdParticipant phdParticipant : process.getAssistantGuidingsSet()) { if (phdParticipant.isInternal()) { if (countAssistantGuidings > 0) { assistantGuidings.append(";"); } assistantGuidings.append(((InternalPhdParticipant) phdParticipant).getPerson().getIstUsername()); countAssistantGuidings++; } } row.setCell(assistantGuidings.toString()); // Nome do Orientador Externo int countExternalGuidings = 0; StringBuilder externalGuidingNames = new StringBuilder(); for (PhdParticipant phdParticipant : process.getGuidingsSet()) { if (!phdParticipant.isInternal()) { if (countExternalGuidings > 0) { externalGuidingNames.append(";"); } externalGuidingNames.append(((ExternalPhdParticipant) phdParticipant).getName()); externalGuidingNames.append(" ("); externalGuidingNames.append(((ExternalPhdParticipant) phdParticipant).getInstitution()); externalGuidingNames.append(")"); countExternalGuidings++; } } row.setCell(externalGuidingNames.toString()); // Nome do Co-Orientador Externo int countExternalAssistantGuidings = 0; StringBuilder externalAssistantGuidingNames = new StringBuilder(); for (PhdParticipant phdParticipant : process.getAssistantGuidingsSet()) { if (!phdParticipant.isInternal()) { if (countExternalAssistantGuidings > 0) { externalAssistantGuidingNames.append(";"); } externalAssistantGuidingNames.append(((ExternalPhdParticipant) phdParticipant).getName()); externalAssistantGuidingNames.append(" ("); externalAssistantGuidingNames.append(((ExternalPhdParticipant) phdParticipant).getInstitution()); externalAssistantGuidingNames.append(")"); countExternalAssistantGuidings++; } } row.setCell(externalAssistantGuidingNames.toString()); PhdProgramProcessState lastActiveState = process.getMostRecentState(); row.setCell(lastActiveState != null ? lastActiveState.getType().getLocalizedName() : "n/a"); if (process.getCollaborationType() != null) { row.setCell(process.getCollaborationType().getLocalizedName()); } else { row.setCell("n/a"); } if (process.getCandidacyDate() != null) { row.setCell(process.getCandidacyDate().toString("dd/MM/yyyy")); } else { row.setCell("n/a"); } if (process.getCandidacyProcess().getWhenRatified() != null) { row.setCell(process.getCandidacyDate().toString("dd/MM/yyyy")); } else { row.setCell("n/a"); } if (process.getWhenStartedStudies() != null) { row.setCell(process.getWhenStartedStudies().toString("dd/MM/yyyy")); } else { row.setCell("n/a"); } if (process.getThesisProcess() != null && process.getThesisProcess().getDiscussionDate() != null) { row.setCell(process.getThesisProcess().getDiscussionDate().toString("dd/MM/yyyy")); } else { row.setCell("n/a"); } // Tipo de Acordo (AFA, AM, ERASMUS, etc) row.setCell(registration != null ? registration.getRegistrationProtocol() != null ? registration.getRegistrationProtocol().getCode() : "" : ""); // Data de Apresentao Pblica da CAT if (process.getSeminarProcess() != null && process.getSeminarProcess().getPresentationDate() != null) { row.setCell(process.getSeminarProcess().getPresentationDate().toString("dd/MM/yyyy")); } else { row.setCell("n/a"); } }
From source file:net.sourceforge.fenixedu.domain.student.curriculum.ExtraCurricularActivity.java
License:Open Source License
public Partial getStart() { DateTime start = getActivityInterval().getStart(); return new Partial().with(DateTimeFieldType.year(), start.getYear()).with(DateTimeFieldType.monthOfYear(), start.getMonthOfYear());/*from w ww .j a v a 2 s. co m*/ }
From source file:net.sourceforge.fenixedu.domain.student.curriculum.ExtraCurricularActivity.java
License:Open Source License
public Partial getEnd() { DateTime end = getActivityInterval().getEnd(); return new Partial().with(DateTimeFieldType.year(), end.getYear()).with(DateTimeFieldType.monthOfYear(), end.getMonthOfYear());/*from w w w.j a v a2 s .com*/ }
From source file:net.sourceforge.fenixedu.domain.vigilancy.UnavailablePeriod.java
License:Open Source License
public String getUnavailableAsString() { DateTime begin = this.getBeginDate(); DateTime end = this.getEndDate(); return String.format("%02d/%02d/%d (%02d:%02d) - %02d/%02d/%d (%02d:%02d): %s", begin.getDayOfMonth(), begin.getMonthOfYear(), begin.getYear(), begin.getHourOfDay(), begin.getMinuteOfHour(), end.getDayOfMonth(), end.getMonthOfYear(), end.getYear(), end.getHourOfDay(), end.getMinuteOfHour(), this.getJustification()); }