Search in sources :

Example 1 with EPArtefactNotification

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

the class EPNotificationManager method getArtefactNotifications.

private List<EPArtefactNotification> getArtefactNotifications(List<Long> mapKey, Date compareDate) {
    if (mapKey == null || mapKey.isEmpty()) {
        return Collections.emptyList();
    }
    StringBuilder sb = new StringBuilder();
    sb.append("select notification from ").append(EPArtefactNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and (notification.key in (:mapKey) or notification.rootMapKey in (:mapKey))");
    DBQuery query = dbInstance.createQuery(sb.toString());
    query.setDate("currentDate", compareDate);
    query.setParameterList("mapKey", mapKey);
    @SuppressWarnings("unchecked") List<EPArtefactNotification> notifications = query.list();
    return notifications;
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery) EPArtefactNotification(org.olat.portfolio.model.notification.EPArtefactNotification)

Example 2 with EPArtefactNotification

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

the class EPNotificationManager method getArtefactNotifications.

public List<SubscriptionListItem> getArtefactNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPArtefactNotification> links = getArtefactNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPArtefactNotification link : links) {
        Long pageKey = link.getPageKey();
        String targetTitle = link.getStructureTitle();
        String[] title = new String[] { StringHelper.escapeHtml(userManager.getUserDisplayName(link.getAuthor())), StringHelper.escapeHtml(link.getArtefactTitle()), StringHelper.escapeHtml(targetTitle) };
        String bPath = rootBusinessPath + "[EPPage:" + pageKey + "]";
        String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
        SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.newartefact", title), linkUrl, bPath, link.getCreationDate(), "o_icon_eportfolio_link");
        item.setUserObject(pageKey);
        items.add(item);
    }
    return items;
}
Also used : SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) ArrayList(java.util.ArrayList) EPArtefactNotification(org.olat.portfolio.model.notification.EPArtefactNotification)

Example 3 with EPArtefactNotification

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

the class EPNotificationManager method getArtefactNotifications.

public List<SubscriptionListItem> getArtefactNotifications(List<Long> mapKey, String rootBusinessPath, Date compareDate, Translator translator) {
    List<EPArtefactNotification> links = getArtefactNotifications(mapKey, compareDate);
    List<SubscriptionListItem> items = new ArrayList<SubscriptionListItem>();
    for (EPArtefactNotification link : links) {
        Long pageKey = link.getPageKey();
        String targetTitle = link.getStructureTitle();
        String[] title = new String[] { StringHelper.escapeHtml(userManager.getUserDisplayName(link.getAuthor())), StringHelper.escapeHtml(link.getArtefactTitle()), StringHelper.escapeHtml(targetTitle) };
        String bPath = rootBusinessPath + "[EPPage:" + pageKey + "]";
        String linkUrl = BusinessControlFactory.getInstance().getURLFromBusinessPathString(bPath);
        SubscriptionListItem item = new SubscriptionListItem(translator.translate("li.newartefact", title), linkUrl, bPath, link.getCreationDate(), "o_icon_eportfolio_link");
        item.setUserObject(pageKey);
        items.add(item);
    }
    return items;
}
Also used : SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) ArrayList(java.util.ArrayList) EPArtefactNotification(org.olat.portfolio.model.notification.EPArtefactNotification)

Example 4 with EPArtefactNotification

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

the class EPNotificationManager method getArtefactNotifications.

private List<EPArtefactNotification> getArtefactNotifications(List<Long> mapKey, Date compareDate) {
    if (mapKey == null || mapKey.isEmpty()) {
        return Collections.emptyList();
    }
    StringBuilder sb = new StringBuilder();
    sb.append("select notification from ").append(EPArtefactNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and (notification.key in (:mapKey) or notification.rootMapKey in (:mapKey))");
    DBQuery query = dbInstance.createQuery(sb.toString());
    query.setDate("currentDate", compareDate);
    query.setParameterList("mapKey", mapKey);
    @SuppressWarnings("unchecked") List<EPArtefactNotification> notifications = query.list();
    return notifications;
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery) EPArtefactNotification(org.olat.portfolio.model.notification.EPArtefactNotification)

Aggregations

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