List of usage examples for org.joda.time LocalDate toString
public String toString(String pattern)
From source file:net.sourceforge.fenixedu.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()); if (conclusionProcess.isCycleConclusionProcess()) { row.setCell(((CycleConclusionProcess) conclusionProcess).getCycleType().getDescription()); } else {//from w w w .ja va2 s. c o m row.setCell(StringUtils.EMPTY); } row.setCell(registration.getPrecedentDegreeConclusionGrade(SchoolLevelType.SECOND_CYCLE_BASIC_SCHOOL)); row.setCell( 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.getFinalAverage()); setPersonCells(registration, row); }
From source file:net.sourceforge.fenixedu.domain.reports.RaidesPhdReportFile.java
License:Open Source License
private void reportRaidesGraduate(Spreadsheet spreadsheet, PhdIndividualProgramProcess process, ExecutionYear executionYear) {//w w w.j ava 2s . c o m 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.presentationTier.docs.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().getUnit().getActiveUnitCoordinator().getFirstAndLastName()); addParameter("name", person.getName()); addParameter("address", person.getAddress()); addParameter("areaCode", person.getAreaCode()); addParameter("areaOfAreaCode", person.getAreaOfAreaCode()); addParameter("programName", individualProgramProcess.getPhdProgram().getName().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); }
From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.v3.ClassTimeTableWithLinksLessonContentRenderer.java
License:Open Source License
@Override public String renderTitleText(final LessonSlot lessonSlot) { final StringBuilder builder = new StringBuilder(super.renderTitleText(lessonSlot)); final InfoShowOccupation occupation = lessonSlot.getInfoLessonWrapper().getInfoShowOccupation(); if (occupation instanceof InfoLessonInstanceAggregation) { final InfoLessonInstanceAggregation aggregation = (InfoLessonInstanceAggregation) occupation; for (final LocalDate localDate : aggregation.getDates()) { builder.append('\n'); builder.append(localDate.toString("yyyy-MM-dd")); }//from w ww .j a va2 s. c o m } return builder.toString(); }
From source file:net.sourceforge.fenixedu.webServices.jersey.beans.publico.FenixPeriod.java
License:Open Source License
public FenixPeriod(final LocalDate start, final LocalDate end) { this.start = start == null ? null : start.toString("yyyy-MM-dd"); this.end = end == null ? null : end.toString("yyyy-MM-dd"); }
From source file:nl.surfnet.coin.selfservice.control.StatisticsController.java
License:Apache License
@RequestMapping(value = "/stats.csv", method = RequestMethod.GET) public void csvStats(@RequestParam(value = "startDateAsMillis") long startDateAsMillis, @RequestParam(value = "intervalType") String intervalType, @RequestParam(value = "spEntityId", required = false) final String spEntityId, HttpServletRequest request, HttpServletResponse response) throws IOException { InstitutionIdentityProvider selectedIdp = getSelectedIdp(request); LocalDate startDate = new LocalDate(startDateAsMillis); LocalDate endDate = getEndDate(intervalType, startDate); List<LoginData> loginData = getLoginData(spEntityId, selectedIdp, startDate, endDate); List<String[]> result = createCSVRows(loginData); response.setContentType("Content-Type: application/csv"); response.setHeader("Content-Disposition", format("attachment; filename=%s-%s.csv", startDate.toString(DATE_PATTERN), intervalType)); try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(response.getOutputStream()))) { writer.writeAll(result);//from www. ja v a2s. co m } catch (IOException e) { throw new RuntimeException(e); } }
From source file:org.activiti.form.engine.impl.cmd.GetCompletedFormDefinitionCmd.java
License:Apache License
public void fillVariablesWithFormValues(Map<String, JsonNode> submittedFormFieldMap, List<FormField> allFields) { for (FormField field : allFields) { JsonNode fieldValueNode = submittedFormFieldMap.get(field.getId()); if (fieldValueNode == null || fieldValueNode.isNull()) { continue; }//from w ww . j ava 2 s .co m String fieldType = field.getType(); String fieldValue = fieldValueNode.asText(); if (FormFieldTypes.DATE.equals(fieldType)) { try { if (StringUtils.isNotEmpty(fieldValue)) { LocalDate dateValue = LocalDate.parse(fieldValue); variables.put(field.getId(), dateValue.toString("d-M-yyyy")); } } catch (Exception e) { logger.error("Error parsing form date value for process instance " + processInstanceId + " and task " + taskId + " with value " + fieldValue, e); } } else { variables.put(field.getId(), fieldValue); } } }
From source file:org.apache.fineract.infrastructure.scheduledemail.domain.EmailCampaign.java
License:Apache License
public void activate(final AppUser currentUser, final DateTimeFormatter formatter, final LocalDate activationLocalDate) { if (isActive()) { //handle errors if already activated final String defaultUserMessage = "Cannot activate campaign. Campaign is already active."; final ApiParameterError error = ApiParameterError.parameterError("error.msg.campaign.already.active", defaultUserMessage, EmailCampaignValidator.activationDateParamName, activationLocalDate.toString(formatter)); final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); }/*w ww .j ava 2s . c o m*/ this.approvedOnDate = activationLocalDate.toDate(); this.approvedBy = currentUser; this.status = EmailCampaignStatus.ACTIVE.getValue(); validate(); }
From source file:org.apache.fineract.infrastructure.sms.domain.SmsCampaign.java
License:Apache License
public void activate(final AppUser currentUser, final DateTimeFormatter formatter, final LocalDate activationLocalDate) { if (isActive()) { //handle errors if already activated final String defaultUserMessage = "Cannot activate campaign. Campaign is already active."; final ApiParameterError error = ApiParameterError.parameterError("error.msg.campaign.already.active", defaultUserMessage, SmsCampaignValidator.activationDateParamName, activationLocalDate.toString(formatter)); final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); }// w w w . j a v a2 s . c o m this.approvedOnDate = activationLocalDate.toDate(); this.approvedBy = currentUser; this.status = SmsCampaignStatus.ACTIVE.getValue(); validate(); }
From source file:org.apache.fineract.portfolio.calendar.service.CalendarUtils.java
License:Apache License
public static String getRRuleReadable(final LocalDate startDate, final String recurringRule) { String humanReadable = ""; RRule rrule;/*from ww w. ja va 2s .co m*/ Recur recur = null; try { rrule = new RRule(recurringRule); rrule.validate(); recur = rrule.getRecur(); } catch (final ValidationException e) { throw new PlatformDataIntegrityException("error.msg.invalid.recurring.rule", "The Recurring Rule value: " + recurringRule + " is not valid.", "recurrence", recurringRule); } catch (final ParseException e) { throw new PlatformDataIntegrityException("error.msg.recurring.rule.parsing.error", "Error in pasring the Recurring Rule value: " + recurringRule, "recurrence", recurringRule); } if (recur == null) { return humanReadable; } if (recur.getFrequency().equals(Recur.DAILY)) { if (recur.getInterval() == 1) { humanReadable = "Daily"; } else { humanReadable = "Every " + recur.getInterval() + " days"; } } else if (recur.getFrequency().equals(Recur.WEEKLY)) { if (recur.getInterval() == 1 || recur.getInterval() == -1) { humanReadable = "Weekly"; } else { humanReadable = "Every " + recur.getInterval() + " weeks"; } humanReadable += " on "; final WeekDayList weekDayList = recur.getDayList(); for (@SuppressWarnings("rawtypes") final Iterator iterator = weekDayList.iterator(); iterator.hasNext();) { final WeekDay weekDay = (WeekDay) iterator.next(); humanReadable += DayNameEnum.from(weekDay.getDay()).getCode(); } } else if (recur.getFrequency().equals(Recur.MONTHLY)) { if (recur.getInterval() == 1) { humanReadable = "Monthly on day " + startDate.getDayOfMonth(); } else { humanReadable = "Every " + recur.getInterval() + " months on day " + startDate.getDayOfMonth(); } } else if (recur.getFrequency().equals(Recur.YEARLY)) { if (recur.getInterval() == 1) { humanReadable = "Annually on " + startDate.toString("MMM") + " " + startDate.getDayOfMonth(); } else { humanReadable = "Every " + recur.getInterval() + " years on " + startDate.toString("MMM") + " " + startDate.getDayOfMonth(); } } if (recur.getCount() > 0) { if (recur.getCount() == 1) { humanReadable = "Once"; } humanReadable += ", " + recur.getCount() + " times"; } final Date endDate = recur.getUntil(); final LocalDate date = new LocalDate(endDate); final DateTimeFormatter fmt = DateTimeFormat.forPattern("dd MMMM YY"); final String formattedDate = date.toString(fmt); if (endDate != null) { humanReadable += ", until " + formattedDate; } return humanReadable; }