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

The following examples show how to use net.fortuna.ical4j.model.PropertyList#getProperty() . 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: ICalConverter.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
protected static void loadWorkEffort(PropertyList<Property> componentProps, GenericValue workEffort) {
    replaceProperty(componentProps, new DtStamp()); // iCalendar object created date/time
    replaceProperty(componentProps, toClazz(workEffort.getString("scopeEnumId")));
    replaceProperty(componentProps, toCreated(workEffort.getTimestamp("createdDate")));
    replaceProperty(componentProps, toDescription(workEffort.getString("description")));
    replaceProperty(componentProps, toDtStart(workEffort.getTimestamp("estimatedStartDate")));
    replaceProperty(componentProps, toLastModified(workEffort.getTimestamp("lastModifiedDate")));
    replaceProperty(componentProps, toPriority(workEffort.getLong("priority")));
    replaceProperty(componentProps, toLocation(workEffort.getString("locationDesc")));
    replaceProperty(componentProps, toStatus(workEffort.getString("currentStatusId")));
    replaceProperty(componentProps, toSummary(workEffort.getString("workEffortName")));
    Property uid = componentProps.getProperty(Uid.UID);
    if (uid == null) {
        // Don't overwrite UIDs created by calendar clients
        replaceProperty(componentProps, toUid(workEffort.getString("workEffortId")));
    }
    replaceProperty(componentProps, toXProperty(workEffortIdXPropName, workEffort.getString("workEffortId")));
}
 
Example 3
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Long fromPercentComplete(PropertyList<Property> propertyList) {
    PercentComplete iCalObj = (PercentComplete) propertyList.getProperty(PercentComplete.PERCENT_COMPLETE);
    if (iCalObj == null) {
        return null;
    }
    return (long) iCalObj.getPercentage();
}
 
Example 4
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 5
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromXProperty(PropertyList<Property> propertyList, String propertyName) {
    if (propertyName == null) {
        return null;
    }
    Property property = propertyList.getProperty(propertyName);
    if (property != null) {
        return property.getValue();
    }
    return null;
}
 
Example 6
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromUid(PropertyList<Property> propertyList) {
    Uid iCalObj = (Uid) propertyList.getProperty(Uid.UID);
    if (iCalObj == null) {
        return null;
    }
    return iCalObj.getValue();
}
 
Example 7
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromSummary(PropertyList<Property> propertyList) {
    Summary iCalObj = (Summary) propertyList.getProperty(Summary.SUMMARY);
    if (iCalObj == null) {
        return null;
    }
    return iCalObj.getValue();
}
 
Example 8
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromStatus(PropertyList<Property> propertyList) {
    Status iCalObj = (Status) propertyList.getProperty(Status.STATUS);
    if (iCalObj == null) {
        return null;
    }
    return fromStatusMap.get(iCalObj.getValue());
}
 
Example 9
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Double fromPriority(PropertyList<Property> propertyList) {
    Priority iCalObj = (Priority) propertyList.getProperty(Priority.PRIORITY);
    if (iCalObj == null) {
        return null;
    }
    return (double) iCalObj.getLevel();
}
 
Example 10
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromClazz(PropertyList<Property> propertyList) {
    Clazz iCalObj = (Clazz) propertyList.getProperty(Clazz.CLASS);
    if (iCalObj == null) {
        return null;
    }
    return "WES_".concat(iCalObj.getValue());
}
 
Example 11
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromLocation(PropertyList<Property> propertyList) {
    Location iCalObj = (Location) propertyList.getProperty(Location.LOCATION);
    if (iCalObj == null) {
        return null;
    }
    return iCalObj.getValue();
}
 
Example 12
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Timestamp fromLastModified(PropertyList<Property> propertyList) {
    LastModified iCalObj = (LastModified) propertyList.getProperty(LastModified.LAST_MODIFIED);
    if (iCalObj == null) {
        return null;
    }
    Date date = iCalObj.getDate();
    return new Timestamp(date.getTime());
}
 
Example 13
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Double fromDuration(PropertyList<Property> propertyList) {
    Duration iCalObj = (Duration) propertyList.getProperty(Duration.DURATION);
    if (iCalObj == null) {
        return null;
    }
    Dur dur = iCalObj.getDuration();
    TimeDuration td = new TimeDuration(0, 0, (dur.getWeeks() * 7) + dur.getDays(), dur.getHours(), dur.getMinutes(), dur.getSeconds(), 0);
    return (double) TimeDuration.toLong(td);
}
 
Example 14
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Timestamp fromDtStart(PropertyList<Property> propertyList) {
    DtStart iCalObj = (DtStart) propertyList.getProperty(DtStart.DTSTART);
    if (iCalObj == null) {
        return null;
    }
    Date date = iCalObj.getDate();
    return new Timestamp(date.getTime());
}
 
Example 15
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Timestamp fromDtEnd(PropertyList<Property> propertyList) {
    DtEnd iCalObj = (DtEnd) propertyList.getProperty(DtEnd.DTEND);
    if (iCalObj == null) {
        return null;
    }
    Date date = iCalObj.getDate();
    return new Timestamp(date.getTime());
}
 
Example 16
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static String fromDescription(PropertyList<Property> propertyList) {
    Description iCalObj = (Description) propertyList.getProperty(Description.DESCRIPTION);
    if (iCalObj == null) {
        return null;
    }
    return iCalObj.getValue();
}
 
Example 17
Source File: ICalConverter.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
protected static Timestamp fromCompleted(PropertyList<Property> propertyList) {
    Completed iCalObj = (Completed) propertyList.getProperty(Completed.COMPLETED);
    if (iCalObj == null) {
        return null;
    }
    Date date = iCalObj.getDate();
    return new Timestamp(date.getTime());
}