static void correctTzValueOf(net.fortuna.ical4j.model.property.TzId tzProperty) { String validTimezone = getCorrectedTimeZoneIdFrom(tzProperty.getValue()); if (validTimezone != null) { tzProperty.setValue(validTimezone); } }
static void correctTzValueOf(net.fortuna.ical4j.model.property.TzId tzProperty) { String validTimezone = getCorrectedTimeZoneIdFrom(tzProperty.getValue()); if (validTimezone != null) { tzProperty.setValue(validTimezone); } }
static void correctTzValueOf(net.fortuna.ical4j.model.property.TzId tzProperty) { String validTimezone = getCorrectedTimeZoneIdFrom(tzProperty.getValue()); if (validTimezone != null) { tzProperty.setValue(validTimezone); } }
/** * Constructs a new instance based on the specified VTimeZone. * * @param vTimeZone a VTIMEZONE object instance */ public TimeZone(final VTimeZone vTimeZone) { this.vTimeZone = vTimeZone; final TzId tzId = vTimeZone.getProperty(Property.TZID); setID(tzId.getValue()); this.rawOffset = getRawOffset(vTimeZone); }
/** * Constructs a new instance based on the specified VTimeZone. * @param vTimeZone a VTIMEZONE object instance */ public TimeZone(final VTimeZone vTimeZone) { this.vTimeZone = vTimeZone; final TzId tzId = (TzId) vTimeZone.getProperty(Property.TZID); setID(tzId.getValue()); this.rawOffset = getRawOffset(vTimeZone); }
/** * Constructs a new instance based on the specified VTimeZone. * * @param vTimeZone a VTIMEZONE object instance */ public TimeZone(final VTimeZone vTimeZone) { this.vTimeZone = vTimeZone; final TzId tzId = vTimeZone.getProperty(Property.TZID); setID(tzId.getValue()); this.rawOffset = getRawOffset(vTimeZone); }
/** * Constructs a new instance based on the specified VTimeZone. * * @param vTimeZone a VTIMEZONE object instance */ public TimeZone(final VTimeZone vTimeZone) { this.vTimeZone = vTimeZone; final TzId tzId = (TzId) vTimeZone.getProperty(Property.TZID); setID(tzId.getValue()); this.rawOffset = getRawOffset(vTimeZone); }
/** * Constructs a new instance based on the specified VTimeZone. * * @param vTimeZone a VTIMEZONE object instance */ public TimeZone(final VTimeZone vTimeZone) { this.vTimeZone = vTimeZone; final TzId tzId = (TzId) vTimeZone.getProperty(Property.TZID); setID(tzId.getValue()); this.rawOffset = getRawOffset(vTimeZone); }
log.warn("Unable to retrieve updates for timezone: " + vTimeZone.getTimeZoneId().getValue(), e);
log.warn("Unable to retrieve updates for timezone: " + vTimeZone.getTimeZoneId().getValue(), e);
/** * @param vTimeZone * @return */ private VTimeZone updateDefinition(VTimeZone vTimeZone) { final TzUrl tzUrl = vTimeZone.getTimeZoneUrl(); if (tzUrl != null) { try { final CalendarBuilder builder = new CalendarBuilder(); final Calendar calendar = builder.build(tzUrl.getUri().toURL().openStream()); final VTimeZone updatedVTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE); if (updatedVTimeZone != null) { return updatedVTimeZone; } } catch (Exception e) { log.warn("Unable to retrieve updates for timezone: " + vTimeZone.getTimeZoneId().getValue(), e); } } return vTimeZone; } }
/** * Compact timezones. * @param calendar The calendar. */ private void compactTimezones(Calendar calendar) { if (calendar==null) { return; } // Get list of timezones in master calendar and remove all timezone // definitions that are in the registry. The idea is to not store // extra data. Instead, the timezones will be added to the calendar // by the getCalendar() api. ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE); List<VTimeZone> toRemove = new ArrayList<>(); for(VTimeZone vtz : timezones) { String tzid = vtz.getTimeZoneId().getValue(); TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid); // Remove timezone iff it matches the one in the registry if(tz!=null && vtz.equals(tz.getVTimeZone())) { toRemove.add(vtz); } } // remove known timezones from master calendar calendar.getComponents().removeAll(toRemove); }
/** * Compact timezones. * @param calendar The calendar. */ private void compactTimezones(Calendar calendar) { if (calendar==null) { return; } // Get list of timezones in master calendar and remove all timezone // definitions that are in the registry. The idea is to not store // extra data. Instead, the timezones will be added to the calendar // by the getCalendar() api. ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE); List<VTimeZone> toRemove = new ArrayList<>(); for(VTimeZone vtz : timezones) { String tzid = vtz.getTimeZoneId().getValue(); TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid); // Remove timezone iff it matches the one in the registry if(tz!=null && vtz.equals(tz.getVTimeZone())) { toRemove.add(vtz); } } // remove known timezones from master calendar calendar.getComponents().removeAll(toRemove); }
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); } }
HashMap<String, VTimeZone> tzMap = new HashMap<String, VTimeZone>(); for(VTimeZone vtz : timezones) { tzMap.put(vtz.getTimeZoneId().getValue(), vtz);
HashMap<String, VTimeZone> tzMap = new HashMap<String, VTimeZone>(); for(VTimeZone vtz : timezones) { tzMap.put(vtz.getTimeZoneId().getValue(), vtz);