use of org.olat.portfolio.model.notification.EPRatingNotification in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getRatingNotifications.
public List<SubscriptionListItem> getRatingNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
List<EPRatingNotification> ratings = getRatingNotifications(mapKey, compareDate);
List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
for (EPRatingNotification rating : ratings) {
if (rating.getPageKey() == null) {
String[] title = new String[] { rating.getMapTitle(), userManager.getUserDisplayName(rating.getAuthor()) };
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(rootBusinessPath);
if (rating.getLastModified() != null) {
// there is a modified date, also add this as a listitem
items.add(new SubscriptionListItem(translator.translate("li.changerating", title), linkUrl, rootBusinessPath, rating.getLastModified(), "o_icon_rating_on"));
}
items.add(new SubscriptionListItem(translator.translate("li.newrating", title), linkUrl, rootBusinessPath, rating.getCreationDate(), "o_icon_rating_on"));
} else {
String bPath = rootBusinessPath + "[EPPage:" + rating.getPageKey() + "]";
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
String[] title = new String[] { rating.getTitle(), userManager.getUserDisplayName(rating.getAuthor()) };
if (rating.getLastModified() != null) {
// there is a modified date, also add this as a listitem
SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.changerating", title), linkUrl, bPath, rating.getLastModified(), "o_icon_rating_on");
item.setUserObject(rating.getPageKey());
items.add(item);
}
SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.newrating", title), linkUrl, bPath, rating.getCreationDate(), "o_icon_rating_on");
item.setUserObject(rating.getPageKey());
items.add(item);
}
}
return items;
}
use of org.olat.portfolio.model.notification.EPRatingNotification in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getRatingNotifications.
private List<EPRatingNotification> getRatingNotifications(List<Long> mapKey, Date compareDate) {
if (mapKey == null || mapKey.isEmpty()) {
return Collections.emptyList();
}
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPRatingNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and notification.mapKey in (:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setParameterList("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPRatingNotification> notifications = query.list();
return notifications;
}
use of org.olat.portfolio.model.notification.EPRatingNotification in project openolat by klemens.
the class EPNotificationManager method getRatingNotifications.
private List<EPRatingNotification> getRatingNotifications(List<Long> mapKey, Date compareDate) {
if (mapKey == null || mapKey.isEmpty()) {
return Collections.emptyList();
}
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPRatingNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and notification.mapKey in (:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setParameterList("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPRatingNotification> notifications = query.list();
return notifications;
}
use of org.olat.portfolio.model.notification.EPRatingNotification in project openolat by klemens.
the class EPNotificationManager method getRatingNotifications.
public List<SubscriptionListItem> getRatingNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
List<EPRatingNotification> ratings = getRatingNotifications(mapKey, compareDate);
List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
for (EPRatingNotification rating : ratings) {
if (rating.getPageKey() == null) {
String[] title = new String[] { rating.getMapTitle(), userManager.getUserDisplayName(rating.getAuthor()) };
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(rootBusinessPath);
if (rating.getLastModified() != null) {
// there is a modified date, also add this as a listitem
items.add(new SubscriptionListItem(translator.translate("li.changerating", title), linkUrl, rootBusinessPath, rating.getLastModified(), "o_icon_rating_on"));
}
items.add(new SubscriptionListItem(translator.translate("li.newrating", title), linkUrl, rootBusinessPath, rating.getCreationDate(), "o_icon_rating_on"));
} else {
String bPath = rootBusinessPath + "[EPPage:" + rating.getPageKey() + "]";
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
String[] title = new String[] { rating.getTitle(), userManager.getUserDisplayName(rating.getAuthor()) };
if (rating.getLastModified() != null) {
// there is a modified date, also add this as a listitem
SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.changerating", title), linkUrl, bPath, rating.getLastModified(), "o_icon_rating_on");
item.setUserObject(rating.getPageKey());
items.add(item);
}
SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.newrating", title), linkUrl, bPath, rating.getCreationDate(), "o_icon_rating_on");
item.setUserObject(rating.getPageKey());
items.add(item);
}
}
return items;
}
Aggregations