net.fortuna.ical4j.model.property.ExDate Java Examples
The following examples show how to use
net.fortuna.ical4j.model.property.ExDate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Calendar_EventRepeatMaster.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * Create list with excluded dates based on the exclusion rule. * * @param recurrenceExc * @return list with excluded dates */ private List<Date> getRecurrenceExcludeDates(final String recurrenceExc) { final List<Date> recurExcDates = new ArrayList<Date>(); if ( StringUtils.isNotEmpty( recurrenceExc )) { try { final net.fortuna.ical4j.model.ParameterList pl = new net.fortuna.ical4j.model.ParameterList(); final ExDate exdate = new ExDate(pl, recurrenceExc); final DateList dl = exdate.getDates(); for (final Object date : dl) { final Date excDate = (Date) date; recurExcDates.add(excDate); } } catch (final ParseException e) { System.out.println("cannot restore recurrence exceptions"); e.printStackTrace(); } } return recurExcDates; }
Example #2
Source File: ICalRecurConverter.java From scipio-erp with Apache License 2.0 | 6 votes |
public static void convert(TemporalExpression expr, PropertyList<Property> 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); }
Example #3
Source File: HibBaseEventStamp.java From cosmo with Apache License 2.0 | 6 votes |
public void setExceptionDates(DateList dates) { if (dates == null) { return; } PropertyList<Property> properties = getEvent().getProperties(); for (Property exdate : properties.getProperties(Property.EXDATE)) { properties.remove(exdate); } if (dates.isEmpty()) { return; } ExDate exDate = new ExDate(dates); setDateListPropertyValue(exDate); properties.add(exDate); }
Example #4
Source File: MockBaseEventStamp.java From cosmo with Apache License 2.0 | 6 votes |
/** * Sets exception dates. * @param dates The date list. */ public void setExceptionDates(DateList dates) { if (dates == null) { return; } PropertyList<Property> properties = getEvent().getProperties(); for (Property exdate : properties.getProperties(Property.EXDATE)) { properties.remove(exdate); } if (dates.isEmpty()) { return; } ExDate exDate = new ExDate(dates); setDateListPropertyValue(exDate); properties.add(exDate); }
Example #5
Source File: CalendarEntry.java From olat with Apache License 2.0 | 6 votes |
/** * Create list with excluded dates based on the exclusion rule. * * @param recurrenceExc * @return list with excluded dates */ private List<Date> getRecurrenceExcludeDates(final String recurrenceExc) { final List<Date> recurExcDates = new ArrayList<Date>(); if (recurrenceExc != null && !recurrenceExc.equals("")) { try { final net.fortuna.ical4j.model.ParameterList pl = new net.fortuna.ical4j.model.ParameterList(); final ExDate exdate = new ExDate(pl, recurrenceExc); final DateList dl = exdate.getDates(); for (final Object date : dl) { final Date excDate = (Date) date; recurExcDates.add(excDate); } } catch (final ParseException e) { log.error("cannot restore recurrence exceptions", e); } } return recurExcDates; }
Example #6
Source File: CalendarEntry.java From olat with Apache License 2.0 | 6 votes |
/** * Create list with excluded dates based on the exclusion rule. * * @param recurrenceExc * @return list with excluded dates */ private List<Date> getRecurrenceExcludeDates(final String recurrenceExc) { final List<Date> recurExcDates = new ArrayList<Date>(); if (recurrenceExc != null && !recurrenceExc.equals("")) { try { final net.fortuna.ical4j.model.ParameterList pl = new net.fortuna.ical4j.model.ParameterList(); final ExDate exdate = new ExDate(pl, recurrenceExc); final DateList dl = exdate.getDates(); for (final Object date : dl) { final Date excDate = (Date) date; recurExcDates.add(excDate); } } catch (final ParseException e) { log.error("cannot restore recurrence exceptions", e); } } return recurExcDates; }
Example #7
Source File: Calendar_EventRepeatMaster.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** * 将指定的日期列表转换为排除表达式 Create exclusion rule based on list with dates. * * @param dates * @return string with exclude rule */ private static String getRecurrenceExcludeRule(final List<Date> dates) { if (ListTools.isNotEmpty( dates )) { final DateList dl = new DateList(); for (final Date date : dates) { final net.fortuna.ical4j.model.Date dd = new net.fortuna.ical4j.model.Date(date); dl.add(dd); } final ExDate exdate = new ExDate(dl); return exdate.getValue(); } return null; }
Example #8
Source File: ICal3ClientFilter.java From cosmo with Apache License 2.0 | 5 votes |
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); }
Example #9
Source File: CalendarEntry.java From olat with Apache License 2.0 | 5 votes |
/** * Create exclusion rule based on list with dates. * * @param dates * @return string with exclude rule */ private static String getRecurrenceExcludeRule(final List<Date> dates) { if (dates != null && dates.size() > 0) { final DateList dl = new DateList(); for (final Date date : dates) { final net.fortuna.ical4j.model.Date dd = new net.fortuna.ical4j.model.Date(date); dl.add(dd); } final ExDate exdate = new ExDate(dl); return exdate.getValue(); } return null; }
Example #10
Source File: CalendarEntry.java From olat with Apache License 2.0 | 5 votes |
/** * Create exclusion rule based on list with dates. * * @param dates * @return string with exclude rule */ private static String getRecurrenceExcludeRule(final List<Date> dates) { if (dates != null && dates.size() > 0) { final DateList dl = new DateList(); for (final Date date : dates) { final net.fortuna.ical4j.model.Date dd = new net.fortuna.ical4j.model.Date(date); dl.add(dd); } final ExDate exdate = new ExDate(dl); return exdate.getValue(); } return null; }