diff --git a/.classpath b/.classpath
index 745b709..b85bd45 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -31,5 +31,5 @@
-
+
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index adde6d9..90832cf 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -4,6 +4,9 @@
+
+ uses
+
diff --git a/pom.xml b/pom.xml
index 84dc326..247dbbb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.gcube.portlets.user
share-updates
war
- 1.9.1-SNAPSHOT
+ 1.9.2-SNAPSHOT
gCube Share Updates Portlet
gCube Share Updates for exchanging updates with other users of VREs.
@@ -58,11 +58,16 @@
gwt-servlet
${gwtVersion}
provided
+
+
+ com.google.gwt
+ gwt-dev
+ ${gwtVersion}
+ provided
com.github.gwtbootstrap
gwt-bootstrap
- 2.3.2.0
org.gcube.common.portal
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateService.java b/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateService.java
index ebc78f2..945b6ba 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateService.java
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateService.java
@@ -19,9 +19,9 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("shareupdateServlet")
public interface ShareUpdateService extends RemoteService {
- ClientFeed sharePostWithLinkPreview(String feedText, FeedType type, PrivacyLevel pLevel, String vreName, LinkPreview preview, String urlThumbnail, ArrayList mentionedUsers, boolean notifyGroup);
+ ClientFeed sharePostWithLinkPreview(String feedText, FeedType type, PrivacyLevel pLevel, Long vreOrgId, LinkPreview preview, String urlThumbnail, ArrayList mentionedUsers, boolean notifyGroup);
- ClientFeed sharePostWithAttachments(String feedText, FeedType type, PrivacyLevel pLevel, String vreName,ArrayList uploadedFiles, ArrayList mentionedUsers, boolean notifyGroup, boolean saveCopyWokspace);
+ ClientFeed sharePostWithAttachments(String feedText, FeedType type, PrivacyLevel pLevel, Long vreOrgId,ArrayList uploadedFiles, ArrayList mentionedUsers, boolean notifyGroup, boolean saveCopyWokspace);
UserSettings getUserSettings();
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateServiceAsync.java b/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateServiceAsync.java
index 7efa21d..f1c5cd9 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/ShareUpdateServiceAsync.java
@@ -29,12 +29,12 @@ public interface ShareUpdateServiceAsync {
void getHashtags(AsyncCallback> callback);
void sharePostWithLinkPreview(String feedText, FeedType type,
- PrivacyLevel pLevel, String vreName, LinkPreview preview,
+ PrivacyLevel pLevel, Long vreOrgId, LinkPreview preview,
String urlThumbnail, ArrayList mentionedUsers, boolean notifyGroup,
AsyncCallback callback);
void sharePostWithAttachments(String feedText, FeedType type,
- PrivacyLevel pLevel, String vreName,
+ PrivacyLevel pLevel, Long vreOrgId,
ArrayList uploadedFiles,
ArrayList mentionedUsers, boolean notifyGroup,
boolean saveCopyWokspace, AsyncCallback callback);
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java
index d24cf39..74f5727 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java
@@ -432,8 +432,9 @@ public class ShareUpdateForm extends Composite {
LinkPreview preview2Share = new LinkPreview(linkTitle, linkDescription, linkUrl, linkHost, null);
+ Long vreOrgId = Long.parseLong(vreId);
// share post (it could contain a link preview)
- shareupdateService.sharePostWithLinkPreview(toShareText, FeedType.TWEET, getPrivacyLevel(), vreId, preview2Share, linkUrlThumbnail, mentionedUsers, notifyGroup, new AsyncCallback() {
+ shareupdateService.sharePostWithLinkPreview(toShareText, FeedType.TWEET, getPrivacyLevel(), vreOrgId, preview2Share, linkUrlThumbnail, mentionedUsers, notifyGroup, new AsyncCallback() {
public void onFailure(Throwable caught) {
submitButton.setEnabled(true);
@@ -490,9 +491,9 @@ public class ShareUpdateForm extends Composite {
file.getFormat()));
}
-
+ Long vreOrgId = Long.parseLong(vreId);
// share the post
- shareupdateService.sharePostWithAttachments(toShareText, FeedType.TWEET, getPrivacyLevel(), vreId, uploadedFiles, mentionedUsers, notifyGroup, saveInWorkspaceCheckbox.getValue(), new AsyncCallback() {
+ shareupdateService.sharePostWithAttachments(toShareText, FeedType.TWEET, getPrivacyLevel(), vreOrgId, uploadedFiles, mentionedUsers, notifyGroup, saveInWorkspaceCheckbox.getValue(), new AsyncCallback() {
@Override
public void onSuccess(ClientFeed feed) {
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 2e80b1b..cd4e55b 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
@@ -21,7 +21,7 @@ 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.applicationsupportlayer.social.storage.UriResolverReaderParameter;
+import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
@@ -147,10 +147,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
*/
@Override
public ClientFeed sharePostWithLinkPreview(String postText, FeedType feedType, PrivacyLevel pLevel,
- String vreId, LinkPreview preview, String urlThumbnail, ArrayList mentionedUserFullNames, boolean notifyGroup) {
+ Long vreOrgId, LinkPreview preview, String urlThumbnail, ArrayList mentionedUserFullNames, boolean notifyGroup) {
-
- _log.debug("Writing a new post with text " + postText);
// escape text
String escapedFeedText = TextTransfromUtils.escapeHtmlAndTransformUrl(postText);
@@ -198,8 +196,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//get the VRE scope if single channel post
String vreScope2Set = "";
- if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0) {
- vreScope2Set = (withinPortal) ? getScopeByOrganizationId(vreId) : session.getScope();
+ if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null) {
+ vreScope2Set = (withinPortal) ? getScopeByOrganizationId(vreOrgId) : session.getScope();
}
// build the feed to share (and save on cassandra)
@@ -213,8 +211,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//need to put the feed into VRES Timeline too
if (pLevel == PrivacyLevel.VRES) {
_log.trace("PrivacyLevel was set to VRES attempting to write onto User's VRES Timelines");
- for (GroupModel vre : getUserVREs(username)) {
- String vreScope = getScopeByOrganizationId(vre.getGroupId());
+ for (GroupModel vre : getUserVREs(username)) {
+ Long orgId = Long.parseLong(vre.getGroupId());
+ String vreScope = getScopeByOrganizationId(orgId);
_log.trace("Attempting to write onto " + vreScope);
try {
store.saveFeedToVRETimeline(toShare.getKey(), vreScope);
@@ -227,7 +226,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
//share on a single VRE Timeline
//receives a VreId(groupId) get the scope from the groupId
- else if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0) {
+ else if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null) {
_log.trace("Attempting to write onto " + vreScope2Set);
try {
store.saveFeedToVRETimeline(toShare.getKey(), vreScope2Set);
@@ -247,15 +246,21 @@ 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(), escapedFeedText, ""+session.getGroupId(), nm, hashtags));
+ if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null && notifyGroup) {
+ NotificationsManager nm = new ApplicationNotificationsManager(
+ vreScope2Set,
+ new SocialNetworkingUser(username, email, fullName, thumbnailAvatarURL),
+ NEWS_FEED_PORTLET_CLASSNAME);
+ Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), escapedFeedText, ""+vreOrgId, nm, hashtags));
thread.start();
}
//send the notification to the mentioned users
if (mentionedUsers != null && mentionedUsers.size() > 0) {
- NotificationsManager nm = new ApplicationNotificationsManager(session);
+ NotificationsManager nm = new ApplicationNotificationsManager(
+ vreScope2Set,
+ new SocialNetworkingUser(username, email, fullName, thumbnailAvatarURL),
+ NEWS_FEED_PORTLET_CLASSNAME);
ArrayList toPass = new ArrayList();
for (ItemBean u : mentionedUsers) {
toPass.add(new GenericItemBean(u.getId(), u.getName(), u.getAlternativeName(), u.getThumbnailURL()));
@@ -267,18 +272,14 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
return cf;
}
-
-
/**
* Share a post with at least one attachment.
*/
@Override
public ClientFeed sharePostWithAttachments(String feedText, FeedType feedType,
- PrivacyLevel pLevel, String vreId, ArrayList uploadedFiles,
+ PrivacyLevel pLevel, Long vreOrgId, ArrayList uploadedFiles,
ArrayList mentionedUserFullNames, boolean notifyGroup, boolean saveCopyWokspace) {
- _log.debug("Incoming text is " + feedText);
-
// escape text
String escapedFeedText = TextTransfromUtils.escapeHtmlAndTransformUrl(feedText);
@@ -380,8 +381,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//get the VRE scope if single channel post
String vreScope2Set = "";
- if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0) {
- vreScope2Set = (withinPortal) ? getScopeByOrganizationId(vreId) : session.getScope();
+ if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null ) {
+ vreScope2Set = (withinPortal) ? getScopeByOrganizationId(vreOrgId) : session.getScope();
}
Feed toShare = null;
@@ -417,8 +418,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//need to put the feed into VRES Timeline too
if (pLevel == PrivacyLevel.VRES) {
_log.trace("PrivacyLevel was set to VRES attempting to write onto User's VRES Timelines");
- for (GroupModel vre : getUserVREs(username)) {
- String vreScope = getScopeByOrganizationId(vre.getGroupId());
+ for (GroupModel vre : getUserVREs(username)) {
+ Long orgId = Long.parseLong(vre.getGroupId());
+ String vreScope = getScopeByOrganizationId(orgId);
_log.trace("Attempting to write onto " + vreScope);
try {
store.saveFeedToVRETimeline(toShare.getKey(), vreScope);
@@ -430,7 +432,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
} //share on a single VRE Timeline
//receives a VreId(groupId) get the scope from the groupId
- else if (pLevel == PrivacyLevel.SINGLE_VRE && vreId != null && vreId.compareTo("") != 0) {
+ else if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null) {
_log.trace("Attempting to write onto " + vreScope2Set);
try {
store.saveFeedToVRETimeline(toShare.getKey(), vreScope2Set);
@@ -450,15 +452,21 @@ 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, hashtags));
+ if (pLevel == PrivacyLevel.SINGLE_VRE && vreOrgId != null && notifyGroup) {
+ NotificationsManager nm = new ApplicationNotificationsManager(
+ vreScope2Set,
+ new SocialNetworkingUser(username, email, fullName, thumbnailAvatarURL),
+ NEWS_FEED_PORTLET_CLASSNAME);
+ Thread thread = new Thread(new PostNotificationsThread(toShare.getKey(), textToPost, ""+vreOrgId, nm, hashtags));
thread.start();
}
//send the notification to the mentioned users
if (mentionedUsers != null && mentionedUsers.size() > 0) {
- NotificationsManager nm = new ApplicationNotificationsManager(session);
+ NotificationsManager nm = new ApplicationNotificationsManager(
+ vreScope2Set,
+ new SocialNetworkingUser(username, email, fullName, thumbnailAvatarURL),
+ NEWS_FEED_PORTLET_CLASSNAME);
ArrayList toPass = new ArrayList();
for (ItemBean u : mentionedUsers) {
toPass.add(new GenericItemBean(u.getId(), u.getName(), u.getAlternativeName(), u.getThumbnailURL()));
@@ -781,12 +789,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
return toReturn;
}
- private String getScopeByOrganizationId(String vreid) {
+ private String getScopeByOrganizationId(Long vreOrgId) {
GroupManager gm = new LiferayGroupManager();
try {
- return gm.getScope(vreid);
+ return gm.getScope(vreOrgId+"");
} catch (Exception e) {
- _log.error("Could not find a scope for this VREid: " + vreid);
+ _log.error("Could not find a scope for this vreOrgId: " + vreOrgId);
return null;
}
}