Java Code Examples for net.fortuna.ical4j.model.PropertyList#remove()

The following examples show how to use net.fortuna.ical4j.model.PropertyList#remove() . 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: ICalRecurConverter.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
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 2
Source File: HibBaseEventStamp.java    From cosmo with Apache License 2.0 6 votes vote down vote up
public void setRecurrenceDates(DateList dates) {
    if (dates == null) {
        return;
    }
    
    PropertyList<RDate> rdateList = getEvent().getProperties().getProperties(Property.RDATE);
    for (RDate rdate : rdateList) {
        rdateList.remove(rdate);
    }
    if (dates.isEmpty()) {
        return;
    }
    
    RDate rDate = new RDate(dates);
    setDateListPropertyValue(rDate);
    rdateList.add(rDate);   
}
 
Example 3
Source File: HibBaseEventStamp.java    From cosmo with Apache License 2.0 6 votes vote down vote up
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 vote down vote up
/**
 * Sets recurrence dates.
 * @param dates The date list.
 */    
public void setRecurrenceDates(DateList dates) { 
    if (dates == null) {
        return;
    }
    
    PropertyList<Property> pl = getEvent().getProperties();
    for (Property rdate : pl.getProperties(Property.RDATE)) {
        pl.remove(rdate);
    }
    if (dates.isEmpty()) {
        return;
    }
    
    RDate rDate = new RDate(dates);
    setDateListPropertyValue(rDate);
    pl.add(rDate);   
}
 
Example 5
Source File: MockBaseEventStamp.java    From cosmo with Apache License 2.0 6 votes vote down vote up
/**
 * 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 6
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static void replaceProperty(PropertyList<Property> propertyList, Property property) {
    if (property == null) {
        return;
    }
    Property existingProp = propertyList.getProperty(property.getName());
    if (existingProp != null) {
        propertyList.remove(existingProp);
    }
    propertyList.add(property);
}
 
Example 7
Source File: HibBaseEventStamp.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public void setRecurrenceRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> properties = getEvent().getProperties();
    for (Property rrule : properties.getProperties(Property.RRULE)) {
        properties.remove(rrule);
    }
    for (Recur recur : recurs) {
        properties.add(new RRule(recur));
    }      
}
 
Example 8
Source File: HibBaseEventStamp.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public void setExceptionRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> properties = getEvent().getProperties();
    for (Property exrule : properties.getProperties(Property.EXRULE)) {
        properties.remove(exrule);
    }
    for (Recur recur : recurs) {
        properties.add(new ExRule(recur));
    }
}
 
Example 9
Source File: MockBaseEventStamp.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Sets recurrence rules.
 * @param recurs List with recurrence rules.
 */
public void setRecurrenceRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> pl = getEvent().getProperties();
    for (Property rrule : pl.getProperties(Property.RRULE)) {
        pl.remove(rrule);
    }
    for (Recur recur : recurs) {
        pl.add(new RRule(recur));
    }
  
}
 
Example 10
Source File: MockBaseEventStamp.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Sets exception rules.
 * @param recurs The list.
 */
public void setExceptionRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> pl = getEvent().getProperties();
    for (Property exrule : pl.getProperties(Property.EXRULE)) {
        pl.remove(exrule);
    }
    for (Recur recur : recurs) {
        pl.add(new ExRule(recur));
    }
}