/** * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by * this recur are retained from the period start, and as such you should ensure the period start is initialised * correctly. * * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates */ public final DateList getDates(final Date periodStart, final Date periodEnd, final Value value) { return getDates(periodStart, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by * this recur are retained from the period start, and as such you should ensure the period start is initialised * correctly. * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates */ public final DateList getDates(final Date periodStart, final Date periodEnd, final Value value) { return getDates(periodStart, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by * this recur are retained from the period start, and as such you should ensure the period start is initialised * correctly. * * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates */ public final DateList getDates(final Date periodStart, final Date periodEnd, final Value value) { return getDates(periodStart, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by * this recur are retained from the period start, and as such you should ensure the period start is initialised * correctly. * * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates */ public final DateList getDates(final Date periodStart, final Date periodEnd, final Value value) { return getDates(periodStart, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by * this recur are retained from the period start, and as such you should ensure the period start is initialised * correctly. * * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates */ public final DateList getDates(final Date periodStart, final Date periodEnd, final Value value) { return getDates(periodStart, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. This method includes a base date * argument, which indicates the start of the fist occurrence of this recurrence. The base date is used to inject * default values to return a set of dates in the correct format. For example, if the search start date (start) is * Wed, Mar 23, 12:19PM, but the recurrence is Mon - Fri, 9:00AM - 5:00PM, the start dates returned should all be at * 9:00AM, and not 12:19PM. * * @param seed the start date of this Recurrence's first instance * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates represented by this recur instance */ public final DateList getDates(final Date seed, final Date periodStart, final Date periodEnd, final Value value) { return getDates(seed, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. This method includes a base date * argument, which indicates the start of the fist occurrence of this recurrence. The base date is used to inject * default values to return a set of dates in the correct format. For example, if the search start date (start) is * Wed, Mar 23, 12:19PM, but the recurrence is Mon - Fri, 9:00AM - 5:00PM, the start dates returned should all be at * 9:00AM, and not 12:19PM. * @return a list of dates represented by this recur instance * @param seed the start date of this Recurrence's first instance * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) */ public final DateList getDates(final Date seed, final Date periodStart, final Date periodEnd, final Value value) { return getDates(seed, periodStart, periodEnd, value, -1); }
/** * Returns a list of start dates in the specified period represented by this recur. This method includes a base date * argument, which indicates the start of the fist occurrence of this recurrence. The base date is used to inject * default values to return a set of dates in the correct format. For example, if the search start date (start) is * Wed, Mar 23, 12:19PM, but the recurrence is Mon - Fri, 9:00AM - 5:00PM, the start dates returned should all be at * 9:00AM, and not 12:19PM. * * @param seed the start date of this Recurrence's first instance * @param periodStart the start of the period * @param periodEnd the end of the period * @param value the type of dates to generate (i.e. date/date-time) * @return a list of dates represented by this recur instance */ public final DateList getDates(final Date seed, final Date periodStart, final Date periodEnd, final Value value) { return getDates(seed, periodStart, periodEnd, value, -1); }
/** * Convenience method for retrieving recurrences in a specified period. * * @param seed a seed date for generating recurrence instances * @param period the period of returned recurrence dates * @param value type of dates to generate * @return a list of dates */ public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
/** * Convenience method for retrieving recurrences in a specified period. * @param seed a seed date for generating recurrence instances * @param period the period of returned recurrence dates * @param value type of dates to generate * @return a list of dates */ public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
/** * Convenience method for retrieving recurrences in a specified period. * * @param seed a seed date for generating recurrence instances * @param period the period of returned recurrence dates * @param value type of dates to generate * @return a list of dates */ public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
/** * Convenience method for retrieving recurrences in a specified period. * * @param seed a seed date for generating recurrence instances * @param period the period of returned recurrence dates * @param value type of dates to generate * @return a list of dates */ public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
/** * Convenience method for retrieving recurrences in a specified period. * * @param seed a seed date for generating recurrence instances * @param period the period of returned recurrence dates * @param value type of dates to generate * @return a list of dates */ public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
/** * */ public void testGetDatesCount() { java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("Australia/Melbourne")); DateList dates = null; if (seed != null) { dates = recur.getDates(seed, periodStart, periodEnd, value); } else { dates = recur.getDates(periodStart, periodEnd, value); } assertEquals(expectedCount, dates.size()); // assertTrue("Date list exceeds expected count", dates.size() <= expectedCount); }
/** * */ public void testGetDatesNotEmpty() { assertFalse(recur.getDates(periodStart, periodEnd, value).isEmpty()); }
/** * */ public void testGetDatesCalendarField() { DateList dates = recur.getDates(periodStart, periodEnd, value); Calendar cal; if ((value != null) && (value == Value.DATE)) { cal = Calendar.getInstance(TimeZones.getDateTimeZone()); } else { cal = Calendar.getInstance(); } dates.forEach(date -> { cal.setTime(date); assertEquals(expectedCalendarValue, cal.get(calendarField)); }); }
public void testGetDatesRalph() throws ParseException { Recur recur = new Recur("FREQ=WEEKLY;WKST=MO;INTERVAL=1;UNTIL=20051003T000000Z;BYDAY=MO,WE"); Calendar queryStartDate = new GregorianCalendar(TimeZone.getTimeZone(TimeZones.UTC_ID)); queryStartDate.set(2005, Calendar.SEPTEMBER, 3, 0, 0, 0); Calendar queryEndDate = new GregorianCalendar(TimeZone.getTimeZone(TimeZones.UTC_ID)); queryEndDate.set(2005, Calendar.OCTOBER, 31, 23, 59, 0); DateList dateList = recur.getDates(new DateTime(queryStartDate.getTime()), new DateTime(queryStartDate.getTime()), new DateTime(queryEndDate.getTime()), Value.DATE_TIME); log.debug(dateList.toString()); }
/** * */ public void testGetDatesTimeZone() { DateList dates = recur.getDates(periodStart, periodEnd, value); dates.forEach(date -> { assertEquals(expectedTimeZone, ((DateTime) date).getTimeZone()); }); }
/** * */ public void testGetDatesOrdering() { DateList dl1 = recur.getDates(periodStart, periodEnd, value); Date prev = null; Date event = null; for(int i=0; i<dl1.size(); i++) { prev = event; event = (Date) dl1.get(i); log.debug("Occurence "+i+" at "+event); assertTrue(prev == null || !prev.after(event)); } }
private void getDates(java.util.Date startRange, java.util.Date endRange, java.util.Date eventStart, Recur recur) { net.fortuna.ical4j.model.Date start = new net.fortuna.ical4j.model.Date(startRange); net.fortuna.ical4j.model.Date end = new net.fortuna.ical4j.model.Date(endRange); net.fortuna.ical4j.model.Date seed = new net.fortuna.ical4j.model.Date(eventStart); DateList dates = recur.getDates(seed, start, end, Value.DATE); for (int i=0; i<dates.size(); i++) { log.info("date_" + i + " = " + dates.get(i).toString()); } }