/** * Return ical4j TimeZone instance for timezone id. * @param id timezone id * @return ical4j TimeZone instance */ public static net.fortuna.ical4j.model.TimeZone getTimeZone(String id) { if(!allTimezoneIds.contains(id)) { return null; } VTimeZone vtz = getVTimeZone(id); if(vtz==null) { return null; } return new net.fortuna.ical4j.model.TimeZone(vtz); }
/** * Return ical4j TimeZone instance for timezone id. * @param id timezone id * @return ical4j TimeZone instance */ public static net.fortuna.ical4j.model.TimeZone getTimeZone(String id) { if(!allTimezoneIds.contains(id)) { return null; } VTimeZone vtz = getVTimeZone(id); if(vtz==null) { return null; } return new net.fortuna.ical4j.model.TimeZone(vtz); }
/** * {@inheritDoc} */ public final void register(final TimeZone timezone, boolean update) { if (update) { try { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID()))); } catch (IOException | ParserException | ParseException e) { Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class); log.warn("Error occurred loading VTimeZone", e); } } else { timezones.put(timezone.getID(), timezone); } }
/** * {@inheritDoc} */ public final void register(final TimeZone timezone, boolean update) { if (update) { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone()))); } else { timezones.put(timezone.getID(), timezone); } }
/** * {@inheritDoc} */ public final void register(final TimeZone timezone, boolean update) { if (update) { try { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID()))); } catch (IOException | ParserException | ParseException e) { Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class); log.warn("Error occurred loading VTimeZone", e); } } else { timezones.put(timezone.getID(), timezone); } }
/** * {@inheritDoc} */ public final void register(final TimeZone timezone, boolean update) { if (update) { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone()))); } else { timezones.put(timezone.getID(), timezone); } }
/** * {@inheritDoc} */ public final void register(final TimeZone timezone, boolean update) { if (update) { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone()))); } else { timezones.put(timezone.getID(), timezone); } }
public TimeZone getTimezone() { Calendar timezone = getTimezoneCalendar(); if (timezone == null) { return null; } VTimeZone vtz = (VTimeZone) timezone.getComponents().getComponent(Component.VTIMEZONE); return new TimeZone(vtz); }
public TimeZone getTimezone() { Calendar timezone = getTimezoneCalendar(); if (timezone == null) { return null; } VTimeZone vtz = (VTimeZone) timezone.getComponents().getComponent(Component.VTIMEZONE); return new TimeZone(vtz); }
/** * @param testMethod * @param vtimezoneDef * @param String zuluStr * @param String expectedLocalStr */ public TimeZoneTest(String testMethod, String vtimezoneDef, String zuluDateTimeStr, String expectedLocalDateTimeStr) throws Exception { super(testMethod); net.fortuna.ical4j.model.Calendar cal = new CalendarBuilder().build(new StringReader(vtimezoneDef)); VTimeZone vtz = (VTimeZone) cal.getComponent(VTimeZone.VTIMEZONE); this.timezone = new TimeZone(vtz); this.zuluDateTimeStr = zuluDateTimeStr; this.expectedLocalDateTimeStr = expectedLocalDateTimeStr; }
private void handleEventCompFilter(ComponentFilter compFilter, NoteItemFilter itemFilter) { // TODO: handle case of multiple VEVENT filters EventStampFilter eventFilter = new EventStampFilter(); itemFilter.getStampFilters().add(eventFilter); TimeRangeFilter trf = compFilter.getTimeRangeFilter(); // handle time-range filter if (trf != null) { eventFilter.setPeriod(trf.getPeriod()); if (trf.getTimezone() != null) { eventFilter.setTimezone(new TimeZone(trf.getTimezone())); } } for (ComponentFilter subComp : compFilter.getComponentFilters()) { throw new IllegalArgumentException("unsupported sub component filter: " + subComp.getName()); } for (PropertyFilter propFilter : compFilter.getPropFilters()) { handleEventPropFilter(propFilter, itemFilter); } }
@Override public void endComponent(String name) { assertComponent(componentBuilder); if (subComponentBuilder != null) { Component subComponent = subComponentBuilder.build(); componentBuilder.subComponent(subComponent); subComponentBuilder = null; } else { CalendarComponent component = componentBuilder.build(); calendar.getComponents().add(component); if (component instanceof VTimeZone && tzRegistry != null) { // register the timezone for use with iCalendar objects.. tzRegistry.register(new TimeZone((VTimeZone) component)); } componentBuilder = null; } }
private void handleEventCompFilter(ComponentFilter compFilter, NoteItemFilter itemFilter) { // TODO: handle case of multiple VEVENT filters EventStampFilter eventFilter = new EventStampFilter(); itemFilter.getStampFilters().add(eventFilter); TimeRangeFilter trf = compFilter.getTimeRangeFilter(); // handle time-range filter if (trf != null) { eventFilter.setPeriod(trf.getPeriod()); if (trf.getTimezone() != null) { eventFilter.setTimezone(new TimeZone(trf.getTimezone())); } } for (ComponentFilter subComp : compFilter.getComponentFilters()) { throw new IllegalArgumentException("unsupported sub component filter: " + subComp.getName()); } for (PropertyFilter propFilter : compFilter.getPropFilters()) { handleEventPropFilter(propFilter, itemFilter); } }
@Override public void endComponent(String name) { assertComponent(componentBuilder); if (subComponentBuilder != null) { Component subComponent = subComponentBuilder.build(); componentBuilder.subComponent(subComponent); subComponentBuilder = null; } else { CalendarComponent component = componentBuilder.build(); calendar.getComponents().add(component); if (component instanceof VTimeZone && tzRegistry != null) { // register the timezone for use with iCalendar objects.. tzRegistry.register(new TimeZone((VTimeZone) component)); } componentBuilder = null; } }
private TimeZoneInfo doTimeZone(final VTimeZone vtz) throws CalFacadeException { TzId tzid = vtz.getTimeZoneId(); if (tzid == null) { throw new CalFacadeException("Missing tzid property"); } String id = tzid.getValue(); //if (debug()) { // debug("Got timezone: \n" + vtz.toString() + " with id " + id); //} try { TimeZone tz = Timezones.getTz(id); String tzSpec = null; if (tz == null) { tz = new TimeZone(vtz); tzSpec = vtz.toString(); } return new TimeZoneInfo(id, tz, tzSpec); } catch (Throwable t) { throw new CalFacadeException(t); } }
/** * Evaluates VJournal time range. * @param journal The VJournal. * @param filter The time range filter. * @return The result. */ private boolean evaluateVJournalTimeRange(VJournal journal, TimeRangeFilter filter) { DtStart start = journal.getStartDate(); if(start==null) { return false; } InstanceList instances = new InstanceList(); if (filter.getTimezone() != null) { instances.setTimezone(new TimeZone(filter.getTimezone())); } instances.addComponent(journal, filter.getPeriod().getStart(), filter.getPeriod().getEnd()); return instances.size() > 0; }
/** * Evaluates VJournal time range. * @param journal The VJournal. * @param filter The time range filter. * @return The result. */ private boolean evaluateVJournalTimeRange(VJournal journal, TimeRangeFilter filter) { DtStart start = journal.getStartDate(); if(start==null) { return false; } InstanceList instances = new InstanceList(); if (filter.getTimezone() != null) { instances.setTimezone(new TimeZone(filter.getTimezone())); } instances.addComponent(journal, filter.getPeriod().getStart(), filter.getPeriod().getEnd()); return instances.size() > 0; }
public void endComponent(final String name) { assertComponent(component); if (subComponent != null) { if (component instanceof VTimeZone) { ((VTimeZone) component).getObservances().add((Observance) subComponent); } else if (component instanceof VEvent) { ((VEvent) component).getAlarms().add((VAlarm) subComponent); } else if (component instanceof VToDo) { ((VToDo) component).getAlarms().add((VAlarm) subComponent); } else if (component instanceof VAvailability) { ((VAvailability) component).getAvailable().add((Available) subComponent); } subComponent = null; } else { calendar.getComponents().add(component); if (component instanceof VTimeZone && tzRegistry != null) { // register the timezone for use with iCalendar objects.. tzRegistry.register(new TimeZone((VTimeZone) component)); } component = null; } }
instances.setTimezone(new TimeZone(filter.getTimezone()));
instances.setTimezone(new TimeZone(filter.getTimezone()));