diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 335abd2..986910a 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -7,6 +7,9 @@
uses
+
+ uses
+
diff --git a/distro/changelog.xml b/distro/changelog.xml
index 9dfa656..46df529 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -1,6 +1,6 @@
+ date="2014-05-09">
Added possibility to alert the users of a VRE when sharing an update
Refined the way to guess content and images when parsing HTML
Improved images recognition when parsing html pages having no image indication from openGraph
@@ -11,6 +11,7 @@
resolved problem with AdBlock plugin
Fixed mention user dialog y-position when textbox is higher than usual due to new lines
Mention users list now returns only the list of the available users in the current organization
+ Fixed posts when multiple tabs are open, now the status is kept on the client
diff --git a/pom.xml b/pom.xml
index bcab07c..de711ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,11 @@
gwt-servlet
provided
+
+ org.gcube.common.portal
+ portal-manager
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+
org.gcube.portal
social-networking-library
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 6aac916..b4fdf87 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
@@ -71,9 +71,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
*
*/
private static final String ADMIN_ROLE = "Administrator";
- /**
- *
- */
+
+ public static final String TEST_USER = "test.user";
private static final String STORAGE_OWNER = "gCubeSocialFramework";
public static final String UPLOAD_DIR = "/social-framework-uploads";
@@ -86,10 +85,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
* The Cassandra store interface
*/
private DatabookStore store;
- /**
- * used for debugging in eclipse
- */
- private boolean withinPortal = false;
/**
* connect to cassandra at startup
*/
@@ -112,19 +107,29 @@ 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");
- withinPortal = false;
- }
- else {
- withinPortal = true;
- }
+ SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
+ }
return SessionManager.getInstance().getASLSession(sessionID, user);
}
public String getDevelopmentUser() {
- String user = "test.user";
- //user = "massimiliano.assante";
+ String user = TEST_USER;
+// user = "massimiliano.assante";
return user;
}
+ /**
+ *
+ * @return true if you're running into the portal, false if in development
+ */
+ private boolean isWithinPortal() {
+ try {
+ UserLocalServiceUtil.getService();
+ return true;
+ }
+ catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
+ _log.trace("Development Mode ON");
+ return false;
+ }
+ }
/**
*
@@ -146,8 +151,10 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
String email = username+"@isti.cnr.it";
String fullName = username+" FULL";
String thumbnailURL = "images/Avatar_default.png";
-
- if (withinPortal) {
+
+ boolean withinPortal = isWithinPortal();
+
+ if (withinPortal && username.compareTo(TEST_USER) != 0) {
try {
UserInfo user = getUserSettings().getUserInfo();
email = user.getEmailaddress();
@@ -174,14 +181,17 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
textToPost = escapedFeedText;
//System.out.println("textToPost=" + textToPost);
}
-
- ScopeBean scope = new ScopeBean(session.getScope());
- String vreId2Set = scope.is(Type.VRE) ? scope.toString() : "";
+
+ //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();
+ }
Feed toShare = new Feed(UUID.randomUUID().toString(), feedType, username, feedDate,
- vreId2Set, url, urlThumbnail, textToPost, pLevel, fullName, email, thumbnailURL, linkTitle, linkDesc, host);
+ vreScope2Set, url, urlThumbnail, textToPost, pLevel, fullName, email, thumbnailURL, linkTitle, linkDesc, host);
- _log.trace("Attempting to save Feed with text: " + textToPost + " Level: " + pLevel);
+ _log.info("Attempting to save Feed with text: " + textToPost + " Level: " + pLevel + " Timeline="+vreScope2Set);
boolean result = store.saveUserFeed(toShare);
@@ -202,14 +212,13 @@ 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) {
- String vreScope = (withinPortal) ? getScopeByOrganizationId(vreId) : "/gcube/devsec/devVRE";
- _log.trace("Attempting to write onto " + vreScope);
+ _log.trace("Attempting to write onto " + vreScope2Set);
try {
- store.saveFeedToVRETimeline(toShare.getKey(), vreScope);
+ store.saveFeedToVRETimeline(toShare.getKey(), vreScope2Set);
} catch (FeedIDNotFoundException e) {
- _log.error("Error writing onto VRES Time Line" + vreScope);
+ _log.error("Error writing onto VRES Time Line" + vreScope2Set);
} //save the feed
- _log.trace("Success writing onto " + vreScope);
+ _log.trace("Success writing onto " + vreScope2Set);
}
if (!result) return null;
@@ -251,10 +260,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
String username = session.getUsername();
String email = username+"@isti.cnr.it";
String fullName = username+" FULL";
- String thumbnailURL = "images/Avatar_default.png";
-
- if (withinPortal) {
- getUserVREs(username);
+ String thumbnailURL = "images/Avatar_default.png";
+
+ if (isWithinPortal() && username.compareTo(TEST_USER) != 0) {
com.liferay.portal.model.UserModel user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
fullName = user.getFirstName() + " " + user.getLastName();
@@ -569,6 +577,10 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
@Override
public ArrayList getPortalUsers() {
ASLSession session = getASLSession();
+ boolean withinPortal = false;
+ if (isWithinPortal() && session.getUsername().compareTo(TEST_USER) != 0) {
+ withinPortal = true;
+ }
return getOrganizationUsers(session.getScope(), session.getUsername(), withinPortal);
}
@@ -626,4 +638,5 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
return portalUsers;
}
+
}
diff --git a/src/test/java/org/gcube/portlets/user/shareupdates/test/TestForDeploy.java b/src/test/java/org/gcube/portlets/user/shareupdates/test/TestForDeploy.java
index 0aded86..b2aaff0 100644
--- a/src/test/java/org/gcube/portlets/user/shareupdates/test/TestForDeploy.java
+++ b/src/test/java/org/gcube/portlets/user/shareupdates/test/TestForDeploy.java
@@ -12,7 +12,7 @@ public class TestForDeploy {
ShareUpdateServiceImpl serviceImpl = new ShareUpdateServiceImpl();
String username = serviceImpl.getDevelopmentUser();
System.out.println("username for deploy is: " + username);
- assertTrue(username.compareTo("test.user") == 0);
+ assertTrue(username.compareTo(ShareUpdateServiceImpl.TEST_USER) == 0);
System.out.println("Test OK!");
}