news-feed/src/main/java/org/gcube/portlets/user/newsfeed/server/MentionNotificationsThread....

40 lines
1.1 KiB
Java

package org.gcube.portlets.user.newsfeed.server;
import java.util.ArrayList;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
*/
public class MentionNotificationsThread implements Runnable {
private static Logger _log = LoggerFactory.getLogger(MentionNotificationsThread.class);
private String postText;
private String postId;
private NotificationsManager nm;
private ArrayList<ItemBean> users;
public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList<ItemBean> users) {
super();
this.postId = postId;
this.postText = postText;
this.nm = nm;
this.users = users;
}
@Override
public void run() {
for (ItemBean userToNotify : users) {
boolean result = nm.notifyUserTag(userToNotify.getName(), postId, postText);
_log.trace("Sending Notification for post mention to: " + userToNotify.getName() + " result?"+ result);
}
}
}