use of net.fortuna.ical4j.model.PropertyList in project openolat by klemens.
the class ICalServlet method updateUrlProperties.
private void updateUrlProperties(Calendar calendar) {
for (Iterator<?> eventIter = calendar.getComponents().iterator(); eventIter.hasNext(); ) {
Object comp = eventIter.next();
if (comp instanceof VEvent) {
VEvent event = (VEvent) comp;
PropertyList ooLinkProperties = event.getProperties(CalendarManager.ICAL_X_OLAT_LINK);
if (ooLinkProperties.isEmpty()) {
continue;
}
Url currentUrl = event.getUrl();
if (currentUrl != null) {
continue;
}
for (Iterator<?> iter = ooLinkProperties.iterator(); iter.hasNext(); ) {
XProperty linkProperty = (XProperty) iter.next();
if (linkProperty != null) {
String encodedLink = linkProperty.getValue();
StringTokenizer st = new StringTokenizer(encodedLink, "ยง", false);
if (st.countTokens() >= 4) {
// provider
st.nextToken();
// id
st.nextToken();
// displayname
st.nextToken();
String uri = st.nextToken();
try {
Url urlProperty = new Url();
urlProperty.setValue(uri);
event.getProperties().add(urlProperty);
break;
} catch (URISyntaxException e) {
log.error("Invalid URL:" + uri);
}
}
}
}
}
}
}
Aggregations