Search in sources :

Example 1 with EPCommentNotification

use of org.olat.portfolio.model.notification.EPCommentNotification in project OpenOLAT by OpenOLAT.

the class EPNotificationManager method getCommentNotifications.

private List<EPCommentNotification> getCommentNotifications(List<Long> mapKey, Date compareDate) {
    if (mapKey == null || mapKey.isEmpty()) {
        return Collections.emptyList();
    }
    StringBuilder sb = new StringBuilder();
    sb.append("select notification from ").append(EPCommentNotification.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<EPCommentNotification> notifications = query.list();
    return notifications;
}
Also used : EPCommentNotification(org.olat.portfolio.model.notification.EPCommentNotification) DBQuery(org.olat.core.commons.persistence.DBQuery)

Example 2 with EPCommentNotification

use of org.olat.portfolio.model.notification.EPCommentNotification in project openolat by klemens.

the class EPNotificationManager method getCommentNotifications.

public List<SubscriptionListItem> getCommentNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPCommentNotification> comments = getCommentNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPCommentNotification comment : comments) {
        SubscriptionListItem item;
        if (comment.getPageKey() == null) {
            String[] title = new String[] { comment.getMapTitle(), userManager.getUserDisplayName(comment.getAuthor()) };
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(rootBusinessPath);
            item = new SubscriptionListItem(translator.translate("li.newcomment", title), linkUrl, rootBusinessPath, comment.getCreationDate(), "o_info_icon");
        } else {
            String bPath = rootBusinessPath + "[EPPage:" + comment.getPageKey() + "]";
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            String[] title = new String[] { comment.getTitle(), userManager.getUserDisplayName(comment.getAuthor()) };
            item = new SubscriptionListItem(translator.translate("li.newcomment", title), linkUrl, bPath, comment.getCreationDate(), "o_info_icon");
            item.setUserObject(comment.getPageKey());
        }
        items.add(item);
    }
    return items;
}
Also used : SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) EPCommentNotification(org.olat.portfolio.model.notification.EPCommentNotification) ArrayList(java.util.ArrayList)

Example 3 with EPCommentNotification

use of org.olat.portfolio.model.notification.EPCommentNotification in project OpenOLAT by OpenOLAT.

the class EPNotificationManager method getCommentNotifications.

public List<SubscriptionListItem> getCommentNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPCommentNotification> comments = getCommentNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPCommentNotification comment : comments) {
        SubscriptionListItem item;
        if (comment.getPageKey() == null) {
            String[] title = new String[] { comment.getMapTitle(), userManager.getUserDisplayName(comment.getAuthor()) };
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(rootBusinessPath);
            item = new SubscriptionListItem(translator.translate("li.newcomment", title), linkUrl, rootBusinessPath, comment.getCreationDate(), "o_info_icon");
        } else {
            String bPath = rootBusinessPath + "[EPPage:" + comment.getPageKey() + "]";
            String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
            String[] title = new String[] { comment.getTitle(), userManager.getUserDisplayName(comment.getAuthor()) };
            item = new SubscriptionListItem(translator.translate("li.newcomment", title), linkUrl, bPath, comment.getCreationDate(), "o_info_icon");
            item.setUserObject(comment.getPageKey());
        }
        items.add(item);
    }
    return items;
}
Also used : SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) EPCommentNotification(org.olat.portfolio.model.notification.EPCommentNotification) ArrayList(java.util.ArrayList)

Example 4 with EPCommentNotification

use of org.olat.portfolio.model.notification.EPCommentNotification in project openolat by klemens.

the class EPNotificationManager method getCommentNotifications.

private List<EPCommentNotification> getCommentNotifications(List<Long> mapKey, Date compareDate) {
    if (mapKey == null || mapKey.isEmpty()) {
        return Collections.emptyList();
    }
    StringBuilder sb = new StringBuilder();
    sb.append("select notification from ").append(EPCommentNotification.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<EPCommentNotification> notifications = query.list();
    return notifications;
}
Also used : EPCommentNotification(org.olat.portfolio.model.notification.EPCommentNotification) DBQuery(org.olat.core.commons.persistence.DBQuery)

Aggregations

EPCommentNotification (org.olat.portfolio.model.notification.EPCommentNotification)4 ArrayList (java.util.ArrayList)2 DBQuery (org.olat.core.commons.persistence.DBQuery)2 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)2