/** * Add a date to the list. The date will be updated to reflect the * timezone of this list. * @param date the date to add * @return true * @see List#add(java.lang.Object) */ public final boolean add(final Date date) { if (date instanceof DateTime) { if (isUtc()) { ((DateTime) date).setUtc(true); } else { ((DateTime) date).setTimeZone(getTimeZone()); } } else if (!Value.DATE.equals(getType())) { final DateTime dateTime = new DateTime(date); dateTime.setTimeZone(getTimeZone()); return dates.add(dateTime); } return dates.add(date); }
if (!this.isUtc() && this.getTimeZone() == null) { dateTime.setUtc(true); } else { dateTime.setTimeZone(getTimeZone()); dateTime.setTimeZone(getTimeZone()); return dates.add(dateTime);
if (!this.isUtc() && this.getTimeZone() == null) { dateTime.setUtc(true); } else { dateTime.setTimeZone(getTimeZone()); dateTime.setTimeZone(getTimeZone()); return dates.add(dateTime);
/** * Instantiate a new datelist with the same type, timezone and utc settings * as the origList. * @param origList * @return a new empty list. */ private static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); } else { list.setTimeZone(origList.getTimeZone()); } return list; }
/** * Instantiate a new datelist with the same type, timezone and utc settings * as the origList. * * @param origList * @return a new empty list. */ public static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); } else { list.setTimeZone(origList.getTimeZone()); } return list; }
if(dateProp.getDates().getTimeZone()!=null) { timezones.add(dateProp.getDates().getTimeZone().getVTimeZone());
/** * Instantiate a new datelist with the same type, timezone and utc settings * as the origList. * * @param origList * @return a new empty list. */ private static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); } else { list.setTimeZone(origList.getTimeZone()); } return list; }
/** * Instantiate a new datelist with the same type, timezone and utc settings * as the origList. * * @param origList * @return a new empty list. */ public static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); } else { list.setTimeZone(origList.getTimeZone()); } return list; }
if(dateProp.getDates().getTimeZone()!=null) { timezones.add(dateProp.getDates().getTimeZone().getVTimeZone());
/** * Instantiate a new datelist with the same type, timezone and utc settings * as the origList. * * @param origList * @return a new empty list. */ private static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); } else { list.setTimeZone(origList.getTimeZone()); } return list; }
/** * Add a date to the list. The date will be updated to reflect the * timezone of this list. * @param date the date to add * @return true * @see List#add(java.lang.Object) */ public final boolean add(final Date date) { if (date instanceof DateTime) { if (isUtc()) { ((DateTime) date).setUtc(true); } else { ((DateTime) date).setTimeZone(getTimeZone()); } } else if (!Value.DATE.equals(getType())) { final DateTime dateTime = new DateTime(date); dateTime.setTimeZone(getTimeZone()); return add((Object) dateTime); } return add((Object) date); }
/** * Ensure timezones are correctly parsed for this property. * @throws Exception */ public void testTimeZones() throws Exception { CalendarBuilder builder = new CalendarBuilder(); Calendar calendar = builder.build(getClass().getResourceAsStream("/samples/valid/EXDATE.ics")); Component event = calendar.getComponent(Component.VEVENT); List<ExDate> exdates = event.getProperties(Property.EXDATE); for (ExDate exDate : exdates) { assertNotNull("This EXDATE should have a timezone", exDate.getDates().getTimeZone()); } }
public DateList getExceptionDates() { DateList dateList = null; PropertyList<ExDate> exDatesProperties = getEvent().getProperties().getProperties(Property.EXDATE); for (ExDate exdate : exDatesProperties) { if(dateList==null) { if(Value.DATE.equals(exdate.getParameter(Parameter.VALUE))) { dateList = new DateList(Value.DATE); } else { dateList = new DateList(Value.DATE_TIME, exdate.getDates().getTimeZone()); } } dateList.addAll(exdate.getDates()); } return dateList; }
public DateList getExceptionDates() { DateList dateList = null; PropertyList<ExDate> exDatesProperties = getEvent().getProperties().getProperties(Property.EXDATE); for (ExDate exdate : exDatesProperties) { if(dateList==null) { if(Value.DATE.equals(exdate.getParameter(Parameter.VALUE))) { dateList = new DateList(Value.DATE); } else { dateList = new DateList(Value.DATE_TIME, exdate.getDates().getTimeZone()); } } dateList.addAll(exdate.getDates()); } return dateList; }
protected void setDateListPropertyValue(DateListProperty prop) { if (prop == null) { return; } Value value = (Value) prop.getParameters().getParameter(Parameter.VALUE); if (value != null) { prop.getParameters().remove(value); } value = prop.getDates().getType(); // set VALUE=DATE but not VALUE=DATE-TIME as its redundant if(value.equals(Value.DATE)) { prop.getParameters().add(value); } // update timezone for now because ical4j DateList doesn't Parameter param = (Parameter) prop.getParameters().getParameter( Parameter.TZID); if (param != null) { prop.getParameters().remove(param); } if(prop.getDates().getTimeZone()!=null) { prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID())); } }
/** * Constructs an <code>ICalDate</code> from an iCalendar date * list. Date lists cannot be anytime. * @param dates The date list. * @throws UnknownTimeZoneException - if something is wrong this exception is thrown. */ public ICalDate(DateList dates) throws UnknownTimeZoneException { value = dates.getType(); tz = dates.getTimeZone(); if (tz != null) { String origId = tz.getID(); tz = tzTranslator.translateToOlsonTz(tz); if (tz == null) { throw new UnknownTimeZoneException(origId); } String id = tz.getVTimeZone().getProperties(). getProperty(Property.TZID).getValue(); tzid = new TzId(id); } text = dates.toString(); this.dates = dates; }
public DateList getRecurrenceDates() { DateList dateList = null; VEvent event = getEvent(); if (event == null) { return null; } PropertyList<RDate> rDateProperties = getEvent().getProperties().getProperties(Property.RDATE); for (RDate rdate : rDateProperties) { if (dateList == null) { if (Value.DATE.equals(rdate.getParameter(Parameter.VALUE))) { dateList = new DateList(Value.DATE); } else { dateList = new DateList(Value.DATE_TIME, rdate.getDates().getTimeZone()); } } dateList.addAll(rdate.getDates()); } return dateList; }
protected void setDateListPropertyValue(DateListProperty prop) { if (prop == null) { return; } Value value = (Value) prop.getParameters().getParameter(Parameter.VALUE); if (value != null) { prop.getParameters().remove(value); } value = prop.getDates().getType(); // set VALUE=DATE but not VALUE=DATE-TIME as its redundant if(value.equals(Value.DATE)) { prop.getParameters().add(value); } // update timezone for now because ical4j DateList doesn't Parameter param = (Parameter) prop.getParameters().getParameter( Parameter.TZID); if (param != null) { prop.getParameters().remove(param); } if(prop.getDates().getTimeZone()!=null) { prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID())); } }
/** * Constructs an <code>ICalDate</code> from an iCalendar date * list. Date lists cannot be anytime. * @param dates The date list. * @throws UnknownTimeZoneException - if something is wrong this exception is thrown. */ public ICalDate(DateList dates) throws UnknownTimeZoneException { value = dates.getType(); tz = dates.getTimeZone(); if (tz != null) { String origId = tz.getID(); tz = tzTranslator.translateToOlsonTz(tz); if (tz == null) { throw new UnknownTimeZoneException(origId); } String id = tz.getVTimeZone().getProperties(). getProperty(Property.TZID).getValue(); tzid = new TzId(id); } text = dates.toString(); this.dates = dates; }
public DateList getRecurrenceDates() { DateList dateList = null; VEvent event = getEvent(); if (event == null) { return null; } PropertyList<RDate> rDateProperties = getEvent().getProperties().getProperties(Property.RDATE); for (RDate rdate : rDateProperties) { if (dateList == null) { if (Value.DATE.equals(rdate.getParameter(Parameter.VALUE))) { dateList = new DateList(Value.DATE); } else { dateList = new DateList(Value.DATE_TIME, rdate.getDates().getTimeZone()); } } dateList.addAll(rdate.getDates()); } return dateList; }