@SuppressWarnings("unchecked") public static void convert(TemporalExpression expr, PropertyList eventProps) { ICalRecurConverter converter = new ICalRecurConverter(); expr.accept(converter); DtStart dateStart = (DtStart) eventProps.getProperty(Property.DTSTART); if (converter.dateStart != null) { if (dateStart != null) { eventProps.remove(dateStart); } dateStart = converter.dateStart; eventProps.add(dateStart); } if (dateStart != null && converter.exRuleList.size() > 0) { // iCalendar quirk - if exclusions exist, then the start date must be excluded also ExDate exdate = new ExDate(); exdate.getDates().add(dateStart.getDate()); converter.exDateList.add(exdate); } eventProps.addAll(converter.incDateList); eventProps.addAll(converter.incRuleList); eventProps.addAll(converter.exDateList); eventProps.addAll(converter.exRuleList); }
@Override public Component transform(Component object) { PropertyList<Attendee> attendees = object.getProperties().getProperties(Property.ATTENDEE); if (attendees.contains(attendee)) { attendees.remove(attendee); } attendees.add(attendee); object.getProperties().addAll(attendees); return object; } }
@Override public Component transform(Component object) { PropertyList<Attendee> attendees = object.getProperties().getProperties(Property.ATTENDEE); if (attendees.contains(attendee)) { attendees.remove(attendee); } attendees.add(attendee); object.getProperties().addAll(attendees); return object; } }
private void fixExDates(Component comp) throws Exception { PropertyList<ExDate> exDates = comp.getProperties(Property.EXDATE); List<Property> toAdd = new ArrayList<>(); List<Property> toRemove = new ArrayList<>(); for(ExDate exDate : exDates) { // ical likes a single exdate if(exDate.getDates().size()==1) { continue; } // remove exdate with multiple dates toRemove.add(exDate); // create single dates instead for(Date date : exDate.getDates()) { ExDate singleEx = (ExDate) exDate.copy(); singleEx.getDates().clear(); singleEx.getDates().add(date); toAdd.add(singleEx); } } // remove exdates with multiple dates comp.getProperties().removeAll(toRemove); // Add all single exdates comp.getProperties().addAll(toAdd); }
private void fixExDates(Component comp) throws Exception { PropertyList<ExDate> exDates = comp.getProperties(Property.EXDATE); List<Property> toAdd = new ArrayList<>(); List<Property> toRemove = new ArrayList<>(); for(ExDate exDate : exDates) { // ical likes a single exdate if(exDate.getDates().size()==1) { continue; } // remove exdate with multiple dates toRemove.add(exDate); // create single dates instead for(Date date : exDate.getDates()) { ExDate singleEx = (ExDate) exDate.copy(); singleEx.getDates().clear(); singleEx.getDates().add(date); toAdd.add(singleEx); } } // remove exdates with multiple dates comp.getProperties().removeAll(toRemove); // Add all single exdates comp.getProperties().addAll(toAdd); }
/** * Merge all properties and components from two specified calendars into one instance. * Note that the merge process is not very sophisticated, and may result in invalid calendar * data (e.g. multiple properties of a type that should only be specified once). * @param c1 the first calendar to merge * @param c2 the second calendar to merge * @return a Calendar instance containing all properties and components from both of the specified calendars */ public static Calendar merge(final Calendar c1, final Calendar c2) { final Calendar result = new Calendar(); result.getProperties().addAll(c1.getProperties()); for (final Iterator i = c2.getProperties().iterator(); i.hasNext();) { final Property p = (Property) i.next(); if (!result.getProperties().contains(p)) { result.getProperties().add(p); } } result.getComponents().addAll(c1.getComponents()); for (final Iterator i = c2.getComponents().iterator(); i.hasNext();) { final Component c = (Component) i.next(); if (!result.getComponents().contains(c)) { result.getComponents().add(c); } } return result; }
cc.getProperties().addAll(attendees);
/** * Merge all properties and components from two specified calendars into one instance. * Note that the merge process is not very sophisticated, and may result in invalid calendar * data (e.g. multiple properties of a type that should only be specified once). * @param c1 the first calendar to merge * @param c2 the second calendar to merge * @return a Calendar instance containing all properties and components from both of the specified calendars */ public static Calendar merge(final Calendar c1, final Calendar c2) { final Calendar result = new Calendar(); result.getProperties().addAll(c1.getProperties()); for (final Property p : c2.getProperties()) { if (!result.getProperties().contains(p)) { result.getProperties().add(p); } } result.getComponents().addAll(c1.getComponents()); for (final CalendarComponent c : c2.getComponents()) { if (!result.getComponents().contains(c)) { result.getComponents().add(c); } } return result; }
/** * Merge all properties and components from two specified calendars into one instance. * Note that the merge process is not very sophisticated, and may result in invalid calendar * data (e.g. multiple properties of a type that should only be specified once). * @param c1 the first calendar to merge * @param c2 the second calendar to merge * @return a Calendar instance containing all properties and components from both of the specified calendars */ public static Calendar merge(final Calendar c1, final Calendar c2) { final Calendar result = new Calendar(); result.getProperties().addAll(c1.getProperties()); for (final Property p : c2.getProperties()) { if (!result.getProperties().contains(p)) { result.getProperties().add(p); } } result.getComponents().addAll(c1.getComponents()); for (final CalendarComponent c : c2.getComponents()) { if (!result.getComponents().contains(c)) { result.getComponents().add(c); } } return result; }
/** * Merge all properties and components from two specified calendars into one instance. * Note that the merge process is not very sophisticated, and may result in invalid calendar * data (e.g. multiple properties of a type that should only be specified once). * @param c1 the first calendar to merge * @param c2 the second calendar to merge * @return a Calendar instance containing all properties and components from both of the specified calendars */ public static Calendar merge(final Calendar c1, final Calendar c2) { final Calendar result = new Calendar(); result.getProperties().addAll(c1.getProperties()); for (final Property p : c2.getProperties()) { if (!result.getProperties().contains(p)) { result.getProperties().add(p); } } result.getComponents().addAll(c1.getComponents()); for (final CalendarComponent c : c2.getComponents()) { if (!result.getComponents().contains(c)) { result.getComponents().add(c); } } return result; }
/** * Merge all properties and components from two specified calendars into one instance. * Note that the merge process is not very sophisticated, and may result in invalid calendar * data (e.g. multiple properties of a type that should only be specified once). * @param c1 the first calendar to merge * @param c2 the second calendar to merge * @return a Calendar instance containing all properties and components from both of the specified calendars */ public static Calendar merge(final Calendar c1, final Calendar c2) { final Calendar result = new Calendar(); result.getProperties().addAll(c1.getProperties()); for (final Property p : c2.getProperties()) { if (!result.getProperties().contains(p)) { result.getProperties().add(p); } } result.getComponents().addAll(c1.getComponents()); for (final CalendarComponent c : c2.getComponents()) { if (!result.getComponents().contains(c)) { result.getComponents().add(c); } } return result; }
newCal.getProperties().addAll(calendar.getProperties());
newCal.getProperties().addAll(calendar.getProperties());
vevprops.addAll(evprops); if (!ev.getSuppressed()) {
newCal.getProperties().addAll(calendar.getProperties());
newCal.getProperties().addAll(calendar.getProperties());