public static TimeZone getUTCTimeZone() { return registry.getTimeZone("UTC"); }
private static void clearTZRegistry(CalendarBuilder cb) { // clear timezone registry if present TimeZoneRegistry tzr = cb.getRegistry(); if(tzr!=null) { tzr.clear(); } } }
@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; } }
@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; } }
/** * @return The timeZone (ical4j) built of the default java timeZone of the user. * @see ThreadLocalUserContext#getTimeZone() */ public static TimeZone getTimeZone(final java.util.TimeZone timeZone) { return registry.getTimeZone(timeZone.getID()); }
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; } }
private static void clearTZRegistry(CalendarBuilder cb) { // clear timezone registry if present TimeZoneRegistry tzr = cb.getRegistry(); if(tzr!=null) { tzr.clear(); } } }
/** * @return The timeZone (ical4j) built of the default java timeZone of the user. * @see ThreadLocalUserContext#getTimeZone() */ public static TimeZone getUserTimeZone() { return registry.getTimeZone(ThreadLocalUserContext.getTimeZone().getID()); }
if (component instanceof VTimeZone && tzRegistry != null) { tzRegistry.register(new TimeZone((VTimeZone) component));
TimeZone translatedTz = registry.getTimeZone(tzId); if(translatedTz!=null) { return translatedTz; return registry.getTimeZone(aliasedTzId);
if (component instanceof VTimeZone && tzRegistry != null) { tzRegistry.register(new TimeZone((VTimeZone) component));
TimeZone translatedTz = registry.getTimeZone(tzId); if(translatedTz!=null) { return translatedTz; return registry.getTimeZone(aliasedTzId);
if ((component instanceof VTimeZone) && (tzRegistry != null)) { tzRegistry.register(new TimeZone((VTimeZone) component));
/** * Gets a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known. * * @param value * time zone value read from ICS file. The value can be a Microsoft time zone id or an invalid time zone * value * @return a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known */ private static String getCorrectedTimeZoneIdFrom(String value) { if (value != null) { value = value.contains("\"") ? value.replaceAll("\"", "") : value; if (TIMEZONE_REGISTRY.getTimeZone(value) != null) { return TIMEZONE_REGISTRY.getTimeZone(value).getID(); } String nameCandidate = MS_TIMEZONE_NAMES.get(value); if (nameCandidate != null) { return TIMEZONE_REGISTRY.getTimeZone(nameCandidate) != null ? TIMEZONE_REGISTRY.getTimeZone(nameCandidate).getID() : nameCandidate; } return MS_TIMEZONE_IDS.get(value); } return null; } }
if ((component instanceof VTimeZone) && (bs.getTzRegistry() != null)) { bs.getTzRegistry().register(new TimeZone((VTimeZone) component));
/** * Gets a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known. * * @param value * time zone value read from ICS file. The value can be a Microsoft time zone id or an invalid time zone * value * @return a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known */ private static String getCorrectedTimeZoneIdFrom(String value) { if (value != null) { value = value.contains("\"") ? value.replaceAll("\"", "") : value; if (TIMEZONE_REGISTRY.getTimeZone(value) != null) { return TIMEZONE_REGISTRY.getTimeZone(value).getID(); } String nameCandidate = MS_TIMEZONE_NAMES.get(value); if (nameCandidate != null) { return TIMEZONE_REGISTRY.getTimeZone(nameCandidate) != null ? TIMEZONE_REGISTRY.getTimeZone(nameCandidate).getID() : nameCandidate; } return MS_TIMEZONE_IDS.get(value); } return null; } }
/** * Gets a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known. * * @param value * time zone value read from ICS file. The value can be a Microsoft time zone id or an invalid time zone * value * @return a valid timezoneId for the specified timezoneValue or <code>null</code> in case the specified time zone * value does not match anything known */ private static String getCorrectedTimeZoneIdFrom(String value) { if (value != null) { value = value.contains("\"") ? value.replaceAll("\"", "") : value; if (TIMEZONE_REGISTRY.getTimeZone(value) != null) { return TIMEZONE_REGISTRY.getTimeZone(value).getID(); } String nameCandidate = MS_TIMEZONE_NAMES.get(value); if (nameCandidate != null) { return TIMEZONE_REGISTRY.getTimeZone(nameCandidate) != null ? TIMEZONE_REGISTRY.getTimeZone(nameCandidate).getID() : nameCandidate; } return MS_TIMEZONE_IDS.get(value); } return null; } }
/** * Attempt to find a matching Olson timezone by searching for * a valid Olson TZID in the specified string at the end. This * happens to be what Lightning does as its timezones look * like: TZID=/mozilla.org/20050126_1/America/Los_Angeles * @param tzname * @return matching Olson timezone, null if no match found */ protected TimeZone findSubStringMatch(String tzname) { for(String id: TimeZoneUtils.getTimeZoneIds()) { if(tzname.endsWith(id)) { return registry.getTimeZone(id); } } return null; } }
/** * Attempt to find a matching Olson timezone by searching for * a valid Olson TZID in the specified string at the end. This * happens to be what Lightning does as its timezones look * like: TZID=/mozilla.org/20050126_1/America/Los_Angeles * @param tzname * @return matching Olson timezone, null if no match found */ protected TimeZone findSubStringMatch(String tzname) { for(String id: TimeZoneUtils.getTimeZoneIds()) { if(tzname.endsWith(id)) { return registry.getTimeZone(id); } } return null; } }
/** * Set the timezone to use when converting floating times to * UTC. Only used if isUTC is set to true. * * @param timezone The timezone. */ public void setTimezone(TimeZone timezone) { if(timezone != null ){ this.timezone = TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(timezone.getID()); } }