diff --git a/pom.xml b/pom.xml
index 4cb3752..fed865f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,12 @@
[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
provided
+
+ org.gcube.applicationsupportlayer
+ aslsocial
+ [0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)
+ provided
+
org.gcube.core
gcf
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java
new file mode 100644
index 0000000..cfede0c
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java
@@ -0,0 +1,37 @@
+package org.gcube.portlets.user.shareupdates.server;
+
+import java.util.ArrayList;
+
+import org.gcube.applicationsupportlayer.social.NotificationsManager;
+import org.gcube.common.core.utils.logging.GCUBEClientLog;
+
+/**
+ *
+ * @author Massimiliano Assante ISTI-CNR
+ *
+ */
+public class MentionNotificationsThread implements Runnable {
+ private static GCUBEClientLog _log = new GCUBEClientLog(MentionNotificationsThread.class);
+
+ private String postText;
+ private String postId;
+ private NotificationsManager nm;
+ private ArrayList userIds;
+
+
+ public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList userIds) {
+ super();
+ this.postId = postId;
+ this.postText = postText;
+ this.nm = nm;
+ this.userIds = userIds;
+ }
+
+ @Override
+ public void run() {
+ for (String userIdToNotify : userIds) {
+ boolean result = nm.notifyUserTag(userIdToNotify, postId, postText);
+ _log.trace("Sending Notification for post mention to: " + userIdToNotify + " result?"+ result);
+ }
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java
index 68db631..57fd935 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java
@@ -19,6 +19,8 @@ import javax.net.ssl.X509TrustManager;
import org.apache.commons.validator.routines.UrlValidator;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
+import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
+import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
@@ -112,8 +114,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
user = "test.user";
-// user = "massimiliano.assante";
-// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
+ user = "massimiliano.assante";
+ SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
withinPortal = false;
}
else {
@@ -122,84 +124,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
System.out.println("SessionID = " + sessionID);
return SessionManager.getInstance().getASLSession(sessionID, user);
}
- /**
- * this method extractPeopleTags from the user post
- * @param postText text with tagged people: txt .. extractPeopleTags(String postText) {
- ArrayList toReturn = new ArrayList();
- String toParse = "" + postText + "";
-
- HtmlCleaner cleaner = new HtmlCleaner();
- // parse the string HTML
- TagNode pageData = cleaner.clean(toParse);
- TagNode[] inputElements = pageData.getElementsByName("input", true);
- if (inputElements != null) {
- for (int i = 0; i < inputElements.length; i++) {
- System.out.println("Found input " + inputElements[i].getAttributes().get("value"));
- toReturn.add(inputElements[i].getAttributes().get("value"));
- }
- } else {
- _log.trace("No person tags in this post");
- }
- return toReturn;
- }
- /**
- * remove all the html and leave the text
- * @param html
- * @return the text inside the html
- */
- private static String html2text(String html) {
- return Jsoup.parse(html).text().replace(" "," ");
- }
-
-
- /**
- * this method is used when posting a feed
- *
- * It converts the tagged people etc etc
- *
- * @return a String ready to be posted
- */
- private String transformPost(String postText) {
- ArrayList taggedPeople = extractPeopleTags(postText);
- if (taggedPeople == null || taggedPeople.size() == 0) { //there are no tagged people, remove html and go
- String escapedFeedText = escapeHtml(postText); //here escape html to avoid xss attacks
- String html = "" + escapedFeedText + "";
- return html2text(html);
- } else {
- _log.trace("postText curing: " + postText);
- // this is needed to reconstruct the place of people tags, selfexplaining i think
- int i = 0;
- while (postText.contains("