use of org.xwiki.notifications.notifiers.rss.NotificationRSSRenderer in project xwiki-platform by xwiki.
the class DefaultNotificationRSSManager method renderFeed.
@Override
public SyndFeed renderFeed(List<CompositeEvent> events) {
SyndFeed feed = new SyndFeedImpl();
// Define the general properties of the rss
feed.setFeedType("rss_2.0");
feed.setTitle(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedTitle"));
// Set the RSS feed link to the service generating the feed
feed.setLink(this.modelBridge.getDocumentURL(new DocumentReference(wikiDescriptorManager.getCurrentWikiId(), Arrays.asList("XWiki", "Notifications", "Code"), "NotificationRSSService"), "get", "outputSyntax=plain"));
// Set the feed description
feed.setDescription(this.contextualLocalizationManager.getTranslationPlain("notifications.rss.feedDescription"));
// Add every given CompositeEvent entry to the rss
List<SyndEntry> entries = new ArrayList<>();
for (CompositeEvent event : events) {
try {
NotificationRSSRenderer renderer = this.getRenderer(event);
if (renderer != null) {
entries.add(renderer.renderNotification(event));
} else {
entries.add(defaultNotificationRSSRenderer.renderNotification(event));
}
} catch (NotificationException e) {
this.logger.warn("Unable to render RSS entry for CompositeEvent [{}] : [{}]", event, ExceptionUtils.getRootCauseMessage(e));
}
}
feed.setEntries(entries);
return feed;
}
Aggregations