use of org.olat.portfolio.model.notification.EPStructureElementNotification in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getPageSubscriptionListItem.
public List<SubscriptionListItem> getPageSubscriptionListItem(Long mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
List<EPStructureElementNotification> notifications = getPageNotifications(mapKey, compareDate);
List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
for (EPNotification notification : notifications) {
SubscriptionListItem item = null;
String[] title = new String[] { StringHelper.escapeHtml(notification.getTitle()) };
if ("page".equals(notification.getType())) {
String bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
item = new SubscriptionListItem(translator.translate("li.newpage", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_page");
item.setUserObject(notification.getPageKey());
} else {
String bPath = rootBusinessPath;
if (notification.getPageKey() != null) {
bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
}
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
item = new SubscriptionListItem(translator.translate("li.newstruct", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_struct");
item.setUserObject(notification.getPageKey());
}
if (item != null) {
items.add(item);
}
}
return items;
}
use of org.olat.portfolio.model.notification.EPStructureElementNotification in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getPageNotifications.
private List<EPStructureElementNotification> getPageNotifications(Long mapKey, Date compareDate) {
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPStructureElementNotification.class.getName()).append(" as notification");
sb.append(" where notification.creationDate>=:currentDate and (notification.key=:mapKey or notification.rootMapKey=:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setLong("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPStructureElementNotification> notifications = query.list();
return notifications;
}
use of org.olat.portfolio.model.notification.EPStructureElementNotification in project openolat by klemens.
the class EPNotificationManager method getPageSubscriptionListItem.
public List<SubscriptionListItem> getPageSubscriptionListItem(Long mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
List<EPStructureElementNotification> notifications = getPageNotifications(mapKey, compareDate);
List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
for (EPNotification notification : notifications) {
SubscriptionListItem item = null;
String[] title = new String[] { StringHelper.escapeHtml(notification.getTitle()) };
if ("page".equals(notification.getType())) {
String bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
item = new SubscriptionListItem(translator.translate("li.newpage", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_page");
item.setUserObject(notification.getPageKey());
} else {
String bPath = rootBusinessPath;
if (notification.getPageKey() != null) {
bPath = rootBusinessPath + "[EPPage:" + notification.getPageKey() + "]";
}
String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
item = new SubscriptionListItem(translator.translate("li.newstruct", title), linkUrl, bPath, notification.getCreationDate(), "o_ep_icon_struct");
item.setUserObject(notification.getPageKey());
}
if (item != null) {
items.add(item);
}
}
return items;
}
use of org.olat.portfolio.model.notification.EPStructureElementNotification in project openolat by klemens.
the class EPNotificationManager method getPageNotifications.
private List<EPStructureElementNotification> getPageNotifications(Long mapKey, Date compareDate) {
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPStructureElementNotification.class.getName()).append(" as notification");
sb.append(" where notification.creationDate>=:currentDate and (notification.key=:mapKey or notification.rootMapKey=:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setLong("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPStructureElementNotification> notifications = query.list();
return notifications;
}
Aggregations