passing hashtags in subject email of post notifications

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@101410 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-11-03 18:35:26 +00:00
parent b966420adf
commit 531ac821b1
3 changed files with 13 additions and 7 deletions

View File

@ -12,5 +12,6 @@ public class ShareUpdates implements EntryPoint {
public void onModuleLoad() {
RootPanel.get("shareUpdateDiv").add(new ShareUpdateForm());
}
}

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.shareupdates.server;
import java.util.List;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
@ -18,22 +20,25 @@ public class PostNotificationsThread implements Runnable {
private String postText;
private String postId;
private String groupId;
private List<String> hashtags;
private NotificationsManager nm;
public PostNotificationsThread(String postId, String postText, String groupId, NotificationsManager nm) {
public PostNotificationsThread(String postId, String postText, String groupId, NotificationsManager nm, List<String> hashtags) {
super();
this.postId = postId;
this.postText = postText;
this.groupId = groupId;
this.hashtags = hashtags;
this.nm = nm;
}
@Override
public void run() {
UserManager um = new LiferayUserManager();
String[] hashtagsToPass = hashtags.toArray(new String[hashtags.size()]);
try {
for (UserModel user : um.listUsersByGroup(groupId)) {
boolean result = nm.notifyPost(user.getScreenName(), postId, postText);
boolean result = nm.notifyPost(user.getScreenName(), postId, postText, hashtagsToPass);
_log.trace("Sending Notification for post alert to: " + user.getScreenName() + " result?"+ result);
}
} catch (Exception e) {

View File

@ -110,7 +110,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
user = getDevelopmentUser();
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/USTORE_VRE");
}
return SessionManager.getInstance().getASLSession(sessionID, user);
}
@ -240,7 +240,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//send the notification about this posts to everyone in the group if notifyGroup is true
if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0 && notifyGroup) {
NotificationsManager nm = new ApplicationNotificationsManager(session, NEWS_FEED_PORTLET_CLASSNAME);
Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), textToPost, ""+session.getGroupId(), nm));
Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), textToPost, ""+session.getGroupId(), nm, hashtags));
thread.start();
}