List of usage examples for org.joda.time LocalDate toString
public String toString(String pattern)
From source file:org.egov.ptis.web.controller.dashboard.CMDashboardController.java
License:Open Source License
/** * Provides collection analysis data across all ULBs for MIS Reports * @return response JSON/*from w ww.j av a 2 s . c o m*/ * @throws IOException */ @RequestMapping(value = "/collectionanalysis", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public CollectionAnalysis getCollectionAnalysisForMIS(CollectionDetailsRequest collectionDetailsRequest) { if (StringUtils.isNotBlank(collectionDetailsRequest.getIntervalType())) { String startDate = StringUtils.EMPTY; String endDate = StringUtils.EMPTY; if (WEEK.equalsIgnoreCase(collectionDetailsRequest.getIntervalType())) { // Prepare the start date based on the month number and year String monthStartDateStr = collectionDetailsRequest.getYear().concat("-") .concat(collectionDetailsRequest.getMonth()).concat("-").concat("01"); LocalDate monthStDate = new LocalDate(monthStartDateStr); // Fetch the start date of the 1st week of the month and the last day of the month LocalDate weekStart = monthStDate.dayOfWeek().withMinimumValue(); LocalDate endOfMonth = monthStDate.dayOfMonth().withMaximumValue(); startDate = weekStart.toString(PropertyTaxConstants.DATE_FORMAT_YYYYMMDD); endDate = endOfMonth.toString(PropertyTaxConstants.DATE_FORMAT_YYYYMMDD); } else if (DAY.equalsIgnoreCase(collectionDetailsRequest.getIntervalType())) { // Prepare the first and last days of the week based on the month, year and week of month values DateTime date = new DateTime().withYear(Integer.parseInt(collectionDetailsRequest.getYear())) .withMonthOfYear(Integer.parseInt(collectionDetailsRequest.getMonth())); Calendar cal = date.toCalendar(Locale.getDefault()); cal.set(Calendar.DAY_OF_WEEK, 2); cal.set(Calendar.WEEK_OF_MONTH, Integer.parseInt(collectionDetailsRequest.getWeek())); DateTime weekStartDate = new DateTime(cal).withMillisOfDay(0); startDate = weekStartDate.toString(PropertyTaxConstants.DATE_FORMAT_YYYYMMDD); Date weekEndDate = DateUtils.addDays(weekStartDate.toDate(), 6); endDate = PropertyTaxConstants.DATEFORMATTER_YYYY_MM_DD.format(weekEndDate); } if (WEEK.equalsIgnoreCase(collectionDetailsRequest.getIntervalType()) || DAY.equalsIgnoreCase(collectionDetailsRequest.getIntervalType())) { collectionDetailsRequest.setFromDate(startDate); collectionDetailsRequest.setToDate(endDate); } } return propTaxDashboardService.getCollectionAnalysisData(collectionDetailsRequest, collectionDetailsRequest.getIntervalType()); }
From source file:org.estatio.app.index.maint.IndexValueMaintLineItem.java
License:Apache License
private String check() { @SuppressWarnings("rawtypes") List lineItemObjs = bulkInteractionContext.getDomainObjects(); @SuppressWarnings("unchecked") List<IndexValueMaintLineItem> lineItems = lineItemObjs; // ensure items to process if (lineItems.isEmpty()) { return "No rows in spreadsheet"; }//ww w .j av a2 s .c o m // ensure all rows for a single index String reference = null; for (int i = 0; i < lineItems.size(); i++) { IndexValueMaintLineItem lineItem = lineItems.get(i); String eachReference = lineItem.getReference(); if (reference == null) { reference = eachReference; } else { if (!Objects.equal(reference, eachReference)) { return "Row " + (i + 1) + ": all rows must be for same index reference"; } } } // ensure valueStartDates are sequential LocalDate previousValueStartDate = null; LocalDate eachValueStartDate; for (int i = 0; i < lineItems.size(); i++) { IndexValueMaintLineItem lineItem = lineItems.get(i); eachValueStartDate = lineItem.getValueStartDate(); if (previousValueStartDate != null) { if (!Objects.equal(eachValueStartDate.minusMonths(1), previousValueStartDate)) { return "Row " + (i + 1) + ": all rows must be for sequential; found " + previousValueStartDate.toString("yyyy/MM/dd") + " and " + eachValueStartDate.toString("yyyy/MM/dd"); } } previousValueStartDate = eachValueStartDate; } // if existing index, ensure valueStartDate is: // * either for an existing month, // * or follows on from previous by no more than 1 month Index index = indices.findIndex(reference); boolean existingIndex = index != null; scratchpad.put("index", index); if (existingIndex) { LocalDate firstValueStartDate = null; for (IndexValueMaintLineItem lineItem : lineItems) { firstValueStartDate = lineItem.getValueStartDate(); scratchpad.put("firstValueStartDate", firstValueStartDate); break; } IndexValue existingValue = indexValues.findIndexValueByIndexAndStartDate(index, firstValueStartDate); if (existingValue == null) { LocalDate previousMonthValueStartDate = firstValueStartDate.minusMonths(1); IndexValue previousValue = indexValues.findIndexValueByIndexAndStartDate(index, previousMonthValueStartDate); if (previousValue == null) { IndexValue last = indexValues.findLastByIndex(index); if (last != null) { return "First row (" + firstValueStartDate.toString("yyyy/MM/dd") + ") must be an existing month or " + "for the 1 month after last (" + last.getStartDate().toString("yyyy/MM/dd") + ")"; } } else { scratchpad.put("previousBase", previousValue.getIndexBase()); } } else { scratchpad.put("previousBase", existingValue.getIndexBase()); } } // ensure that baseStartDate and baseFactors change in step LocalDate previousBaseStartDate = null; BigDecimal previousBaseFactor = null; for (int i = 0; i < lineItems.size(); i++) { IndexValueMaintLineItem lineItem = lineItems.get(i); LocalDate eachBaseStartDate = lineItem.getBaseStartDate(); BigDecimal eachBaseFactor = lineItem.getBaseFactor(); if (previousBaseStartDate != null || previousBaseFactor != null) { if (Objects.equal(previousBaseStartDate, eachBaseStartDate) && !Objects.equal(previousBaseFactor, eachBaseFactor)) { return "Base factors can only change if base start date changes; " + "baseStartDate: " + eachBaseStartDate.toString("yyyy/MM/dd") + ", baseFactor: " + eachBaseFactor; } } previousBaseStartDate = eachBaseStartDate; previousBaseFactor = eachBaseFactor; } return null; }
From source file:org.estatio.dom.valuetypes.AbstractInterval.java
License:Apache License
/** * For benefit of subclass toString implementations. *///from w ww . j a v a 2 s . com protected String dateToString(LocalDate localDate, String format) { return localDate == null ? "----------" : localDate.toString(format); }
From source file:org.estatio.services.settings.ApplicationSettingsServiceForEstatio.java
License:Apache License
@Programmatic @Override//from w w w.j a v a 2s.co m public ApplicationSettingForEstatio newLocalDate(final String key, final String description, final LocalDate value) { return newSetting(key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER)); }
From source file:org.estatio.services.settings.SettingAbstractForEstatio.java
License:Apache License
@MemberOrder(name = "ValueAsLocalDate", sequence = "1") @Named("Update")//from ww w . j av a2 s. c o m public SettingAbstractForEstatio updateAsLocalDate(final @Named("Value") LocalDate value) { setValueRaw(value.toString(DATE_FORMATTER)); return this; }
From source file:org.estatio.services.settings.UserSettingsServiceForEstatio.java
License:Apache License
@Programmatic @Override// w w w. java2 s .co m public UserSettingForEstatio newLocalDate(final String user, final String key, final String description, final LocalDate value) { return newSetting(user, key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER)); }
From source file:org.fenixedu.academic.domain.accounting.Event.java
License:Open Source License
public DebtInterestCalculator getDebtInterestCalculator(DateTime when) { final Builder builder = new Builder(when, InterestRate::getInterestBean); final Map<LocalDate, Money> dueDateAmountMap = getDueDateAmountMap(); final Money baseAmount = dueDateAmountMap.values().stream().reduce(Money.ZERO, Money::add); final Map<LocalDate, Money> dueDatePenaltyAmountMap = getPostingRule().getDueDatePenaltyAmountMap(this, when);//from www.ja v a 2s. c o m final Set<LocalDate> debtInterestExemptions = getDebtInterestExemptions(when); final Set<LocalDate> debtFineExemptions = getDebtFineExemptions(when); final List<LocalDate> dueDates = dueDateAmountMap.keySet().stream().sorted().collect(Collectors.toList()); for (int i = 0; i < dueDates.size(); i++) { final LocalDate date = dueDates.get(i); final Money amount = dueDateAmountMap.get(date); final String debtFormat = BundleUtil.getString(Bundle.ACCOUNTING, "label.accounting.debt.description", Integer.toString(i + 1)); builder.debt(date.toString("dd-MM-yyyy"), getWhenOccured(), date, debtFormat, amount.getAmount(), debtInterestExemptions.contains(date), debtFineExemptions.contains(date)); } dueDatePenaltyAmountMap.forEach((date, amount) -> { builder.fine(date, amount.getAmount()); }); getRefundSet().forEach(refund -> { if (refund.getExcessOnly()) { builder.excessRefund(refund.getExternalId(), refund.getWhenOccured(), refund.getWhenOccured().toLocalDate(), refund.getDescription().getContent(), refund.getAmount().getAmount(), Optional.ofNullable(refund.getAccountingTransaction()) .map(AbstractDomainObject::getExternalId).orElse(null)); } else { builder.refund(refund.getExternalId(), refund.getWhenOccured(), refund.getWhenOccured().toLocalDate(), refund.getDescription().getContent(), refund.getAmount().getAmount()); } }); getNonAdjustingTransactions().forEach(t -> { if (paymentsPredicate.apply(t, when)) { builder.payment(t.getExternalId(), t.getWhenProcessed(), t.getWhenRegistered().toLocalDate(), t.getEvent().getDescription().toString(), t.getAmountWithAdjustment().getAmount(), Optional.ofNullable(t.getRefund()).map(AbstractDomainObject::getExternalId).orElse(null)); } }); getDebtExemptions().forEach(e -> { if (!e.getWhenCreated().isAfter(when)) { builder.debtExemption(e.getExternalId(), e.getWhenCreated(), e.getWhenCreated().toLocalDate(), e.getDescription().toString(), e.getExemptionAmount(baseAmount).getAmount()); } }); this.getDiscountsSet().forEach(d -> { if (!d.getWhenCreated().isAfter(when)) { builder.debtExemption(d.getExternalId(), d.getWhenCreated(), d.getWhenCreated().toLocalDate(), "Desconto", d.getAmount().getAmount()); } }); getExemptionsSet().stream().filter(e -> !e.getWhenCreated().isAfter(when)) .filter(FixedAmountPenaltyExemption.class::isInstance).map(FixedAmountPenaltyExemption.class::cast) .forEach(e -> { if (e.isForInterest()) { builder.interestExemption(e.getExternalId(), e.getWhenCreated(), e.getWhenCreated().toLocalDate(), e.getDescription().toString(), e.getExemptionAmount(baseAmount).getAmount()); } if (e.isForFine()) { builder.fineExemption(e.getExternalId(), e.getWhenCreated(), e.getWhenCreated().toLocalDate(), e.getDescription().toString(), e.getExemptionAmount(baseAmount).getAmount()); } }); builder.setToApplyInterest( FenixEduAcademicConfiguration.isToUseGlobalInterestRateTableForEventPenalties(this)); return builder.build(); }
From source file:org.fenixedu.academic.domain.reports.GraduationReportFile.java
License:Open Source License
private void reportGraduate(final Spreadsheet sheet, final ConclusionProcess conclusionProcess) { final Row row = sheet.addRow(); final Registration registration = conclusionProcess.getRegistration(); final ExecutionYear ingression = conclusionProcess.getIngressionYear(); final ExecutionYear conclusion = conclusionProcess.getConclusionYear(); final LocalDate conclusionDate = conclusionProcess.getConclusionDate(); row.setCell(registration.getNumber()); row.setCell(registration.getName()); setDegreeCells(row, registration.getDegree()); row.setCell(conclusionProcess.getName().getContent()); row.setCell(registration.getPrecedentDegreeConclusionGrade(SchoolLevelType.SECOND_CYCLE_BASIC_SCHOOL)); row.setCell(/*from w ww.j av a2s. c om*/ registration.getEntryGrade() != null ? registration.getEntryGrade().toString() : StringUtils.EMPTY); row.setCell(ingression.getYear()); row.setCell(conclusion == null ? StringUtils.EMPTY : conclusion.getYear()); row.setCell(conclusionDate == null ? StringUtils.EMPTY : conclusionDate.toString("yyyy-MM-dd")); row.setCell(conclusion == null ? StringUtils.EMPTY : String.valueOf(ingression.getDistanceInCivilYears(conclusion) + 1)); row.setCell(conclusionProcess.getFinalGrade().getValue()); setPersonCells(registration, row); }
From source file:org.fenixedu.academic.domain.reports.RaidesPhdReportFile.java
License:Open Source License
private void reportRaidesGraduate(Spreadsheet spreadsheet, PhdIndividualProgramProcess process, ExecutionYear executionYear) {/*w w w . ja v a2s. 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()).getRawGrade().getValue(); } 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(process.getExecutionYear()).getContent()); // Tipo Curso row.setCell(registration != null ? registration.getDegreeType().getName().getContent() : "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 = process.getStudent().getStudentStatutesSet().stream() .anyMatch(statute -> statute.getType().isGrantOwnerStatute() && statute.isValidInExecutionPeriod(executionYear.getFirstExecutionPeriod())); 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 = registration.getLastStudentCurricularPlan() .getEnrolmentsByExecutionYear(executionYear).stream().mapToDouble(Enrolment::getEctsCredits) .sum(); 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 // We can use current year because only the first semester has // occured totalEctsConcludedUntilPreviousYear = registration.getLastStudentCurricularPlan() .getInternalCycleCurriculumGrops().stream() .mapToDouble(cycleCurriculumGroup -> cycleCurriculumGroup.getCreditsConcluded(executionYear)) .sum(); row.setCell(totalEctsConcludedUntilPreviousYear); // N ECTS equivalncia/substituio/dispensa double totalCreditsDismissed = registration.getLastStudentCurricularPlan().getCreditsSet().stream() .filter(Credits::isEquivalence).mapToDouble(Credits::getEnrolmentsEcts).sum(); 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().getUsername()); 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().getUsername()); 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:org.fenixedu.academic.report.phd.notification.PhdNotificationDocument.java
License:Open Source License
@Override protected void fillReport() { final PhdProgramCandidacyProcess candidacyProcess = getNotification().getCandidacyProcess(); final Person person = candidacyProcess.getPerson(); final PhdIndividualProgramProcess individualProgramProcess = candidacyProcess.getIndividualProgramProcess(); addParameter("administrativeOfficeCoordinator", individualProgramProcess.getPhdProgram() .getAdministrativeOffice().getCoordinator().getProfile().getDisplayName()); addParameter("name", person.getName()); addParameter("address", person.getAddress()); addParameter("areaCode", person.getAreaCode()); addParameter("areaOfAreaCode", person.getAreaOfAreaCode()); final ExecutionYear executionYear = individualProgramProcess.getExecutionYear(); addParameter("programName", individualProgramProcess.getPhdProgram().getName(executionYear).getContent(getLanguage())); addParameter("processNumber", individualProgramProcess.getProcessNumber()); final LocalDate whenRatified = candidacyProcess.getWhenRatified(); addParameter("ratificationDate", whenRatified != null ? whenRatified.toString(getDateFormat()) : ""); addParameter("insuranceFee", getInsuranceFee(individualProgramProcess)); addParameter("registrationFee", getRegistrationFee(individualProgramProcess, whenRatified)); addParameter("date", new LocalDate().toString(getDateFormat())); addParameter("notificationNumber", getNotification().getNotificationNumber()); addGuidingsParameter(individualProgramProcess); }