/**
* @see org.olat.notifications.NotificationsHandler#createSubscriptionInfo(org.olat.notifications.Subscriber,
* java.util.Locale, java.util.Date)
*/
public SubscriptionInfo createSubscriptionInfo(final Subscriber subscriber, Locale locale, Date compareDate) {
Publisher p = subscriber.getPublisher();
Date latestNews = p.getLatestNewsDate();
String businessPath = p.getBusinessPath() + "[path=";
SubscriptionInfo si;
// there could be news for me, investigate deeper
try {
if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
String folderRoot = p.getData();
final List<FileInfo> fInfos = FolderManager.getFileInfos(folderRoot, compareDate);
final Translator translator = Util.createPackageTranslator(FolderNotificationsHandler.class, locale);
si = new SubscriptionInfo(getTitleItem(p, translator), null);
SubscriptionListItem subListItem;
for (Iterator<FileInfo> it_infos = fInfos.iterator(); it_infos.hasNext();) {
FileInfo fi = it_infos.next();
String title = fi.getRelPath();
MetaInfo metaInfo = fi.getMetaInfo();
String iconCssClass = null;
if (metaInfo != null) {
if (metaInfo.getTitle() != null) {
title += " (" + metaInfo.getTitle() + ")";
}
iconCssClass = metaInfo.getIconCssClass();
}
Identity ident = fi.getAuthor();
Date modDate = fi.getLastModified();
String desc = translator.translate("notifications.entry", new String[] { title, NotificationHelper.getFormatedName(ident) });
String urlToSend = null;
if(p.getBusinessPath() != null) {
urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessPath + fi.getRelPath() + "]");
}
subListItem = new SubscriptionListItem(desc, urlToSend, modDate, iconCssClass);
si.addSubscriptionListItem(subListItem);
}