setEncoding(RSSServlet.DEFAULT_ENCODING);
User user = identity.getUser();
Locale locale = I18nManager.getInstance().getLocaleOrDefault(user.getPreferences().getLanguage());
Translator translator = Util.createPackageTranslator(PersonalRSSFeed.class, locale);
NotificationsManager man = NotificationsManager.getInstance();
List<Bookmark> bookmarks = BookmarkManager.getInstance().findBookmarksByIdentity(identity);
setTitle(translator.translate("rss.title", new String[] { identity.getName() }));
setLink(RSSUtil.URI_SERVER);
setDescription(translator.translate("rss.description", new String[] { identity.getName() }));
// create and add an image to the feed
SyndImage image = new SyndImageImpl();
image.setUrl(Settings.createServerURI() + StaticMediaDispatcher.createStaticURIFor("images/olat/olatlogo32x32.png"));
image.setTitle("OLAT - Online Learning And Training");
image.setLink(getLink());
setImage(image);
List<SyndEntry> entries = new ArrayList<SyndEntry>();
SyndEntry entry = new SyndEntryImpl();
entry.setTitle(translator.translate("rss.olat.title", new String[] { NotificationHelper.getFormatedName(identity) }));
entry.setLink(getLink());
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue(translator.translate("rss.olat.description"));
entry.setDescription(description);
entries.add(entry);
// bookmark news
for (Bookmark bookmark : bookmarks) {
SyndEntry item = new SyndEntryImpl();
item.setTitle(translator.translate("rss.bookmark.title", new String[] { bookmark.getTitle() }));
// create jump in link with factory method from manager
String itemLink = BookmarkManager.getInstance().createJumpInURL(bookmark);
item.setLink(itemLink);
SyndContent itemDescription = new SyndContentImpl();
itemDescription.setType("text/plain");
itemDescription.setValue(bookmark.getDescription());
item.setDescription(itemDescription);
entries.add(item);
}
// notification news
// we are only interested in subscribers which listen to a valid publisher
List<Subscriber> subs = man.getValidSubscribers(identity);
for (Subscriber subscriber : subs) {
SubscriptionItem si = man.createSubscriptionItem(subscriber, locale, SubscriptionInfo.MIME_PLAIN, SubscriptionInfo.MIME_HTML);
if (si != null) {
SyndEntry item = new SyndEntryImpl();
item.setTitle(si.getTitle());
item.setLink(si.getLink());
SyndContent itemDescription = new SyndContentImpl();