/** * Create a base Calendar containing a single component. * @param comp Component to add to the base Calendar * @param icalUid uid of component, if null no UID * property will be added to the component * @return base Calendar */ public static Calendar createBaseCalendar(CalendarComponent comp, String icalUid) { Uid uid = new Uid(icalUid); comp.getProperties().add(uid); return createBaseCalendar(comp); }
/** * Create a base Calendar containing a single component. * @param comp Component to add to the base Calendar * @param icalUid uid of component, if null no UID * property will be added to the component * @return base Calendar */ public static Calendar createBaseCalendar(CalendarComponent comp, String icalUid) { Uid uid = new Uid(icalUid); comp.getProperties().add(uid); return createBaseCalendar(comp); }
public String getTimezoneName() { Calendar timezone = getTimezoneCalendar(); if (timezone == null) { return null; } return timezone.getComponents().getComponent(Component.VTIMEZONE). getProperties().getProperty(Property.TZID).getValue(); }
public String getTimezoneName() { Calendar timezone = getTimezoneCalendar(); if (timezone == null) { return null; } return timezone.getComponents().getComponent(Component.VTIMEZONE). getProperties().getProperty(Property.TZID).getValue(); }
PropertyList attendees = cc.getProperties(Property.ATTENDEE); cc.getProperties().removeAll(attendees); cc.getProperties().addAll(attendees);
public void endProperty(final String name) { assertProperty(property); // replace with a constant instance if applicable.. property = Constants.forProperty(property); if (component != null) { if (subComponent != null) { subComponent.getProperties().add(property); } else { component.getProperties().add(property); } } else if (calendar != null) { calendar.getProperties().add(property); } property = null; }
@Override public CalendarComponent transform(CalendarComponent object) { PropertyList compProps = object.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } return object; } }
@Override public CalendarComponent transform(CalendarComponent object) { PropertyList compProps = object.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } return object; } }
@Override public void endCalendar() throws IOException { if (propertiesWithTzId.size() > 0 && tzRegistry != null) { for (CalendarComponent component : calendar.getComponents()) { resolveTimezones(component.getProperties()); if (component instanceof VAvailability) { for (Component available : ((VAvailability) component).getAvailable()) { resolveTimezones(available.getProperties()); } } else if (component instanceof VEvent) { for (Component alarm : ((VEvent) component).getAlarms()) { resolveTimezones(alarm.getProperties()); } } else if (component instanceof VToDo) { for (Component todo : ((VToDo) component).getAlarms()) { resolveTimezones(todo.getProperties()); } } } } consumer.accept(calendar); }
@Override public void endCalendar() throws IOException { if (propertiesWithTzId.size() > 0 && tzRegistry != null) { for (CalendarComponent component : calendar.getComponents()) { resolveTimezones(component.getProperties()); if (component instanceof VAvailability) { for (Component available : ((VAvailability) component).getAvailable()) { resolveTimezones(available.getProperties()); } } else if (component instanceof VEvent) { for (Component alarm : ((VEvent) component).getAlarms()) { resolveTimezones(alarm.getProperties()); } } else if (component instanceof VToDo) { for (Component todo : ((VToDo) component).getAlarms()) { resolveTimezones(todo.getProperties()); } } } } consumer.accept(calendar); }
PropertyList<Property> props = comp.getProperties(); for(Property prop : props) { if(prop instanceof DateProperty) {
PropertyList<Property> props = comp.getProperties(); for(Property prop : props) { if(prop instanceof DateProperty) {
ExDate x = new ExDate(); x.setValue(recurrenceId); master.getProperties().add(x);
for (final Property p : c.getProperties()) { final TzId tzid = (TzId) p.getParameter(Parameter.TZID); if (tzid != null) {
for (Object oAttendee: event.getProperties(Property.ATTENDEE)) { Attendee a = (Attendee) oAttendee; if (a.getValue().startsWith("mailto:")) {
for (Object oAttendee: event.getProperties(Property.ATTENDEE)) { Attendee a = (Attendee) oAttendee; if (a.getValue().startsWith("mailto:")) {
for (final Property p : c.getProperties()) { final TzId tzid = p.getParameter(Parameter.TZID); if (tzid != null) {
for (final Property p : c.getProperties()) { final TzId tzid = p.getParameter(Parameter.TZID); if (tzid != null) {
/** * @throws IOException * @throws ParserException */ public void testTzIdCompatibility() throws IOException, ParserException { CalendarBuilder builder = new CalendarBuilder(); Calendar calendar = builder.build(getClass().getResourceAsStream("/samples/valid/tmeher.ics")); // ensure the calendar is loaded properly.. assertNotNull(calendar); TimeZoneRegistry registry = builder.getRegistry(); calendar.getComponents().forEach(calendarComponent -> { calendarComponent.getProperties().forEach(property -> { TzId tzId = property.getParameter(Parameter.TZID); if (tzId != null) { assertNotNull(registry.getTimeZone(tzId.getValue())); } }); }); } }
/** * Test escaping of commas in categories. */ public void testCommaEscaping() throws ValidationException, IOException, ParserException { Categories cat1 = new Categories("test1"); Categories cat2 = new Categories("test2"); Categories cat3 = new Categories("test1,test2,test 1\\,2\\,3"); VEvent event = new VEvent(); event.getProperties().add(cat1); event.getProperties().add(cat2); event.getProperties().add(cat3); Calendar calendar = new Calendar(); calendar.getComponents().add(event); StringWriter tempOut = new StringWriter(); CalendarOutputter cout = new CalendarOutputter(false); cout.output(calendar, tempOut); CalendarBuilder builder = new CalendarBuilder(); calendar = builder.build(new StringReader(tempOut.getBuffer() .toString())); List<Categories> categories = calendar.getComponent(Component.VEVENT) .getProperties(Property.CATEGORIES); assertEquals(cat1, categories.get(0)); assertEquals(cat2, categories.get(1)); assertEquals(cat3, categories.get(2)); assertEquals(3, cat3.getCategories().size()); }