public static String TimezoneDefToTzId(String timezoneDef) { try { CalendarBuilder builder = new CalendarBuilder(); net.fortuna.ical4j.model.Calendar cal = builder.build(new StringReader(timezoneDef)); VTimeZone timezone = (VTimeZone) cal.getComponent(VTimeZone.VTIMEZONE); return timezone.getTimeZoneId().getValue(); } catch (Exception ex) { Log.w(TAG, "Can't understand time zone definition", ex); } return null; }
// TODO: this is work in progress; see issue 48 @Ignore @Test public void queryPartialCalendar() throws CalDAV4JException { Calendar calendar = null; GenerateQuery gq = new GenerateQuery(); // query by UID in a given timerange calendar = null; gq.setFilter("VEVENT : UID==" + ICS_GOOGLE_DAILY_NY_5PM_UID); gq.setRecurrenceSet("20060101T170000Z", "20060103T230000Z", CalendarData.EXPAND); List<Calendar> calendars = collection.queryCalendars(fixture.getHttpClient(), gq.generate()); assertNotNull(calendars); assertEquals("bad number of responses: ", 3, calendars.size()); for (Calendar c : calendars) { assertEquals(ICalendarUtils.getUIDValue(calendar), ICS_GOOGLE_DAILY_NY_5PM_UID); assertNotNull( ICalendarUtils.getPropertyValue( c.getComponent(Component.VEVENT), Property.RECURRENCE_ID)); } // check if is in cache }