/** * @param rRule * @return this for chaining. */ @Transient public TeamEventDO setRecurrence(final RRule rRule) { if (rRule == null || rRule.getRecur() == null) { this.recurrenceRuleObject = null; this.recurrenceRule = null; this.recurrenceUntil = null; return this; } final Recur recur = rRule.getRecur(); if (recur.getUntil() != null) { this.recurrenceUntil = recur.getUntil(); } else { this.recurrenceUntil = null; } this.recurrenceRuleObject = null; // do not use rRule param here! this.recurrenceRule = rRule.getValue(); return this; }
/** * ICU4J generates VTIMEZONE RRULEs with floating UNTIL, which results * in a bad VTIMEZONE because the UNTIL is converted to UTC, which will * be different depending on the default timezone of the server. So * to fix this, always add a day to UNTIL to make sure the RRULE * doesn't fall short. This should work for most timezones as timezones * don't usually change from day to day. Hopefully this is fixed in * an icu4j update. * @param vtz */ protected static void fixIcuVTimeZone(VTimeZone vtz) { for(Iterator<Observance> obIt = vtz.getObservances().iterator();obIt.hasNext();) { PropertyList<RRule> rruleList= obIt.next().getProperties(Property.RRULE); for(RRule rrule: rruleList) { Recur recur = rrule.getRecur(); if(recur.getUntil()!=null) { recur.getUntil().setTime(recur.getUntil().getTime() + ONE_DAY); } } } }
/** * ICU4J generates VTIMEZONE RRULEs with floating UNTIL, which results * in a bad VTIMEZONE because the UNTIL is converted to UTC, which will * be different depending on the default timezone of the server. So * to fix this, always add a day to UNTIL to make sure the RRULE * doesn't fall short. This should work for most timezones as timezones * don't usually change from day to day. Hopefully this is fixed in * an icu4j update. * @param vtz */ protected static void fixIcuVTimeZone(VTimeZone vtz) { for(Iterator<Observance> obIt = vtz.getObservances().iterator();obIt.hasNext();) { PropertyList<RRule> rruleList= obIt.next().getProperties(Property.RRULE); for(RRule rrule: rruleList) { Recur recur = rrule.getRecur(); if(recur.getUntil()!=null) { recur.getUntil().setTime(recur.getUntil().getTime() + ONE_DAY); } } } }
private boolean preCheckSendMail(final TeamEventDO event) { // check event ownership if (event.isOwnership() != null && event.isOwnership() == false) { return false; } // check date, send mails for future events only final Date now = new Date(); if (event.getStartDate().after(now)) { return true; } // No recurrence so event is in the past if (event.getRecurrenceRule() == null) { return false; } // Check rrule to see if an until date exists try { final RRule rRule = new RRule(event.getRecurrenceRule()); final net.fortuna.ical4j.model.Date until = rRule.getRecur().getUntil(); if (until == null) { return true; } final Date untilDate = new Date(until.getTime()); return untilDate.before(now) == false; } catch (ParseException e) { return false; } }
final Date candidateSeed = Dates.getInstance(cal.getTime(), value); if (getUntil() != null && candidate != null && candidate.after(getUntil())) { && (dates.size() + invalidCandidates.size()) >= getCount()) { break; } else if (!(getUntil() != null && candidate.after(getUntil()))) { dates.add(candidate);
final Date candidateSeed = Dates.getInstance(cal.getTime(), value); if (getUntil() != null && candidate != null && candidate.after(getUntil())) { && (dates.size() + invalidCandidateCount) >= getCount()) { break; } else if (!(getUntil() != null && candidate.after(getUntil()))) { dates.add(candidate);
private static Date getLastDate(final Recur r, Date start, final Date maxRangeEnd) { Date seed = start; Date until = r.getUntil();
if (rRule.getRecur().getUntil() != null) { SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.YYYY", ThreadLocalUserContext.getLocale()); Date date = new Date(rRule.getRecur().getUntil().getTime()); msg += stringBuilder.append(" " + I18nHelper.getLocalizedMessage("plugins.teamcal.event.event.endsAt", formatter.format(date))).toString();
rrc.setFreq(Freq.valueOf(recur.getFrequency())); Date until = recur.getUntil(); if (until != null) { rrc.setUntil(until);
private void testRRule(final TimeZone timeZone) { TeamEventDO event = createEvent(timeZone, "2012-12-21 8:30", "2012-12-21 9:00", null, 1, null, null); assertNull(event.getRecurrenceObject()); event = createEvent(timeZone, "2012-12-21 8:30", "2012-12-21 9:00", RecurrenceFrequency.WEEKLY, 1, null, null); assertEquals("FREQ=WEEKLY;INTERVAL=1", event.getRecurrenceRule()); Collection<TeamEvent> events = getRecurrenceEvents("2012-12-01", "2013-01-31", timeZone, event); assertEvents(events, timeZone, "2012-12-21 08:30", "2012-12-28 08:30", "2013-01-04 08:30", "2013-01-11 08:30", "2013-01-18 08:30", "2013-01-25 08:30"); String untilInTimeZone = "2013-01-31"; if (timeZone.getRawOffset() < 0) { untilInTimeZone = "2013-02-01"; } event = createEvent(timeZone, "2012-12-21 18:30", "2012-12-22 9:00", RecurrenceFrequency.WEEKLY, 2, "2013-01-31", untilInTimeZone); RRule rRule = event.getRecurrenceRuleObject(); final String utcString = DateHelper.formatIsoDate(rRule.getRecur().getUntil(), DateHelper.UTC); assertEquals("WEEKLY", rRule.getRecur().getFrequency()); assertEquals(untilInTimeZone, utcString); assertEquals(2, rRule.getRecur().getInterval()); events = getRecurrenceEvents("2012-12-01", "2013-03-31", timeZone, event); assertEvents(events, timeZone, "2012-12-21 18:30", "2013-01-04 18:30", "2013-01-18 18:30"); assertTrue(events.iterator().next() instanceof TeamEventDO); }
Date until = r.getUntil(); if (until != null) { UntilRecurType u = new UntilRecurType();
Date until = r.getUntil(); if (until != null) { UntilRecurType u = new UntilRecurType();