public boolean isEmpty() { return this.calendar.getComponents(Component.VEVENT).isEmpty(); }
/** * {@inheritDoc} */ public final boolean useDaylightTime() { final ComponentList<Observance> daylights = vTimeZone.getObservances().getComponents(Observance.DAYLIGHT); return (!daylights.isEmpty()); }
/** * {@inheritDoc} */ public final boolean useDaylightTime() { final ComponentList daylights = vTimeZone.getObservances().getComponents(Observance.DAYLIGHT); return (!daylights.isEmpty()); }
/** * {@inheritDoc} */ public final boolean useDaylightTime() { final ComponentList<Observance> daylights = vTimeZone.getObservances().getComponents(Observance.DAYLIGHT); return (!daylights.isEmpty()); }
/** * {@inheritDoc} */ public final boolean useDaylightTime() { final ComponentList<Observance> daylights = vTimeZone.getObservances().getComponents(Observance.DAYLIGHT); return (!daylights.isEmpty()); }
/** * {@inheritDoc} */ public final boolean useDaylightTime() { final ComponentList<Observance> daylights = vTimeZone.getObservances().getComponents(Observance.DAYLIGHT); return (!daylights.isEmpty()); }
/** * Returns the first component containing a property with the specified * value. * @param propertyValue the value of the property identified in the returned * component * @return a component or null if no component is found containing a property * with the specified value */ public Component getComponent(final String propertyValue) { final ComponentList components = getComponents(propertyValue); if (!components.isEmpty()) { return (Component) components.iterator().next(); } return null; } }
/** * Returns the first component containing a property with the specified * value. * @param propertyValue the value of the property identified in the returned * component * @return a component or null if no component is found containing a property * with the specified value */ public T getComponent(final String propertyValue) { final ComponentList<T> components = getComponents(propertyValue); if (!components.isEmpty()) { return components.get(0); } return null; } }
/** * Returns the first component containing a property with the specified * value. * @param propertyValue the value of the property identified in the returned * component * @return a component or null if no component is found containing a property * with the specified value */ public T getComponent(final String propertyValue) { final ComponentList<T> components = getComponents(propertyValue); if (!components.isEmpty()) { return components.get(0); } return null; } }
/** * Returns the first component containing a property with the specified * value. * @param propertyValue the value of the property identified in the returned * component * @return a component or null if no component is found containing a property * with the specified value */ public T getComponent(final String propertyValue) { final ComponentList<T> components = getComponents(propertyValue); if (!components.isEmpty()) { return components.get(0); } return null; } }
/** * Returns the first component containing a property with the specified * value. * @param propertyValue the value of the property identified in the returned * component * @return a component or null if no component is found containing a property * with the specified value */ public T getComponent(final String propertyValue) { final ComponentList<T> components = getComponents(propertyValue); if (!components.isEmpty()) { return components.get(0); } return null; } }
protected void setCalendar(Calendar calendar) throws CosmoDavException { ComponentList<VEvent> vevents = calendar.getComponents(Component.VEVENT); if (vevents.isEmpty()) { throw new UnprocessableEntityException("VCALENDAR does not contain any VEVENTs"); } getEventStamp().setEventCalendar(calendar); }
protected void setCalendar(Calendar calendar) throws CosmoDavException { ComponentList<VEvent> vevents = calendar.getComponents(Component.VEVENT); if (vevents.isEmpty()) { throw new UnprocessableEntityException("VCALENDAR does not contain any VEVENTs"); } getEventStamp().setEventCalendar(calendar); }
private static VTimeZone generateTimezoneForId(String timezoneId) throws ParseException { if (!TIMEZONE_DEFINITIONS.contains(timezoneId)) { return null; } TimeZone javaTz = TimeZone.getTimeZone(timezoneId); ZoneId zoneId = ZoneId.of(javaTz.getID(), ZoneId.SHORT_IDS); int rawTimeZoneOffsetInSeconds = javaTz.getRawOffset() / 1000; VTimeZone timezone = new VTimeZone(); timezone.getProperties().add(new TzId(timezoneId)); addTransitions(zoneId, timezone, rawTimeZoneOffsetInSeconds); addTransitionRules(zoneId, rawTimeZoneOffsetInSeconds, timezone); if (timezone.getObservances() == null || timezone.getObservances().isEmpty()) { timezone.getObservances().add(NO_TRANSITIONS); } return timezone; }
private static VTimeZone generateTimezoneForId(String timezoneId) throws ParseException { if (!TIMEZONE_DEFINITIONS.contains(timezoneId)) { return null; } TimeZone javaTz = TimeZone.getTimeZone(timezoneId); ZoneId zoneId = ZoneId.of(javaTz.getID(), ZoneId.SHORT_IDS); int rawTimeZoneOffsetInSeconds = javaTz.getRawOffset() / 1000; VTimeZone timezone = new VTimeZone(); timezone.getProperties().add(new TzId(timezoneId)); addTransitions(zoneId, timezone, rawTimeZoneOffsetInSeconds); addTransitionRules(zoneId, rawTimeZoneOffsetInSeconds, timezone); if (timezone.getObservances() == null || timezone.getObservances().isEmpty()) { timezone.getObservances().add(NO_TRANSITIONS); } return timezone; }
private static VTimeZone generateTimezoneForId(String timezoneId) throws ParseException { if(!TIMEZONE_DEFINITIONS.contains(timezoneId)){ return null; } java.util.TimeZone javaTz = java.util.TimeZone.getTimeZone(timezoneId); ZoneId zoneId = ZoneId.of(javaTz.getID(), ZoneId.SHORT_IDS); int rawTimeZoneOffsetInSeconds = javaTz.getRawOffset() / 1000; VTimeZone timezone = new VTimeZone(); timezone.getProperties().add(new TzId(timezoneId)); addTransitions(zoneId, timezone, rawTimeZoneOffsetInSeconds); addTransitionRules(zoneId, rawTimeZoneOffsetInSeconds, timezone); if(timezone.getObservances() == null || timezone.getObservances().isEmpty()){ timezone.getObservances().add(NO_TRANSITIONS); } return timezone; }
public void testVAvailability() throws ParserException, IOException { CalendarBuilder calendarBuilder = new CalendarBuilder(); String availability = getVAvailabilityICal(); Reader reader = new StringReader(availability); Calendar calendar = calendarBuilder.build(reader); Component availabilityComponent = calendar.getComponent(Component.VAVAILABILITY); Assert.assertNotNull(availabilityComponent); Assert.assertFalse(((VAvailability) availabilityComponent).getAvailable().isEmpty()); String iCalString = calendar.toString(); Assert.assertTrue(iCalString.contains("BEGIN:AVAILABLE")); Assert.assertEquals(iCalString.trim(), availability); }
protected DavContent createCalendarResource(DavRequest request, DavResponse response, DavResourceLocator locator, Calendar calendar) throws CosmoDavException { if (!calendar.getComponents(Component.VEVENT).isEmpty()) { return new DavEvent(locator, getResourceFactory(), getEntityFactory()); } if (!calendar.getComponents(Component.VTODO).isEmpty()) { return new DavTask(locator, getResourceFactory(), getEntityFactory()); } if (!calendar.getComponents(Component.VJOURNAL).isEmpty()) { return new DavJournal(locator, getResourceFactory(), getEntityFactory()); } if (!calendar.getComponents(Component.VFREEBUSY).isEmpty()) { return new DavFreeBusy(locator, getResourceFactory(), getEntityFactory()); } if (!calendar.getComponents(ICalendarConstants.COMPONENT_VAVAILABLITY) .isEmpty()) { return new DavAvailability(locator, getResourceFactory(), getEntityFactory()); } throw new SupportedCalendarComponentException(); } }
@SuppressWarnings("unchecked") public T build() { Component component = null; for (ComponentFactory factory : factories) { if (factory.supports(name)) { if (!subComponents.isEmpty()) { component = factory.createComponent(properties, subComponents); } else { component = factory.createComponent(properties); } } } if (component == null) { if (isExperimentalName(name)) { component = new XComponent(name, properties); } else if (allowIllegalNames()) { component = new XComponent(name, properties); } else { throw new IllegalArgumentException("Unsupported component [" + name + "]"); } } return (T) component; } }
/** * <p> * @param cal Imports a calendar object containing a VJOURNAL. Sets the * following properties: * </p> * <ul> * <li>display name: the VJOURNAL's SUMMARY (or the item's name, if the * SUMMARY is blank)</li> * <li>icalUid: the VJOURNAL's UID</li> * <li>body: the VJOURNAL's DESCRIPTION</li> * </ul> */ public void setCalendar(Calendar cal) throws CosmoDavException { NoteItem note = (NoteItem) getItem(); ComponentList<VJournal> vjournals = cal.getComponents(Component.VJOURNAL); if (vjournals.isEmpty()) { throw new UnprocessableEntityException("VCALENDAR does not contain any VJOURNALS"); } EntityConverter converter = new EntityConverter(getEntityFactory()); converter.convertJournalCalendar(note, cal); }