2014-04-10 17:45:50 +02:00
|
|
|
package org.gcube.portlets.user.newsfeed.server;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
2014-10-08 23:15:42 +02:00
|
|
|
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
2014-04-10 17:45:50 +02:00
|
|
|
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;
|
2014-10-08 23:15:42 +02:00
|
|
|
private ArrayList<ItemBean> users;
|
2014-04-10 17:45:50 +02:00
|
|
|
|
|
|
|
|
2014-10-08 23:15:42 +02:00
|
|
|
public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList<ItemBean> users) {
|
2014-04-10 17:45:50 +02:00
|
|
|
super();
|
|
|
|
this.postId = postId;
|
|
|
|
this.postText = postText;
|
|
|
|
this.nm = nm;
|
|
|
|
this.users = users;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2014-10-08 23:15:42 +02:00
|
|
|
for (ItemBean userToNotify : users) {
|
|
|
|
boolean result = nm.notifyUserTag(userToNotify.getName(), postId, postText);
|
|
|
|
_log.trace("Sending Notification for post mention to: " + userToNotify.getName() + " result?"+ result);
|
2014-04-10 17:45:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|