From 10a029ab7b50ec2126068ea8aa9152119c51eb04 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Mon, 10 Jun 2013 16:31:20 +0000 Subject: [PATCH] fixed workspace notification direct opening git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@76956 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../ApplicationNotificationsManager.java | 22 +++++++++---------- .../social/SocialPortalBridge.java | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 257bba0..329ccc4 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -12,7 +12,6 @@ import org.gcube.portal.databook.shared.Notification; import org.gcube.portal.databook.shared.NotificationChannelType; import org.gcube.portal.databook.shared.NotificationType; import org.gcube.portal.databook.shared.RunningJob; -import org.gcube.portal.databook.shared.ex.NotificationChannelTypeNotFoundException; import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem; @@ -37,6 +36,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen */ public ApplicationNotificationsManager(ASLSession session) { super(session); + _log.warn("Asked for Simple Notification (without redirect to creator)"); } /** * Use this constructor if you do need notifications to point back to your applications, @@ -106,7 +106,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - "?oid="+sharedFolder.getId(), + getApplicationUrl()+"?itemid="+sharedFolder.getId(), "shared the workspace folder "+ sharedFolder.getName() +" with you", false, aslSession.getUsername(), @@ -127,7 +127,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify renamedFolderId, //the new Date(), - "?oid="+renamedFolderId, + getApplicationUrl()+"?itemid="+renamedFolderId, "renamed your shared folder "+ previousName +" as " + newName, false, aslSession.getUsername(), @@ -152,7 +152,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - "?oid="+sharedFolder.getId(), + getApplicationUrl()+"?itemid="+sharedFolder.getId(), "added "+ user.getFullname() +" to your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), @@ -183,7 +183,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - "?oid="+sharedFolder.getId(), + getApplicationUrl()+"?itemid="+sharedFolder.getId(), "added "+ addedUsersFullNames +" to your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), @@ -206,7 +206,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - "?oid="+sharedFolder.getId(), + getApplicationUrl()+"?itemid="+sharedFolder.getId(), "unshared his shared folder "+ sharedFolder.getName() + " from your workspace", false, aslSession.getUsername(), @@ -227,7 +227,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), + getApplicationUrl()+"?itemid="+item.getParent().getId(), "added "+ item.getName() +" to your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), @@ -248,8 +248,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), - "removed "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName(), + getApplicationUrl()+"?itemid="+item.getParent().getId(), + "removed item "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -269,7 +269,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), + getApplicationUrl()+"?itemid="+item.getParent().getId(), " updated "+ item.getName() +" to your workspace shared folder "+ item.getParent().getName(), false, aslSession.getUsername(), @@ -290,7 +290,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify renamedItem.getId(), //the new Date(), - "?oid="+renamedItem.getId(), + getApplicationUrl()+"?itemid="+renamedItem.getParent().getId(), "renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName(), false, aslSession.getUsername(), diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java index 70d05c4..f81b92b 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java @@ -93,6 +93,8 @@ public class SocialPortalBridge { * @return the applicationProfile profile */ private ApplicationProfile getProfileFromInfrastrucure(String portletClassName) { + GCUBEScope scope = aslSession.getScope(); + _log.debug("Trying to fetch applicationProfile profile from the infrastructure for " + portletClassName + " scope: " + scope); try { ApplicationProfile toReturn = new ApplicationProfile(); ISClient client = GHNContext.getImplementation(ISClient.class); @@ -104,7 +106,7 @@ public class SocialPortalBridge { " eq '" + portletClassName + "'" + "return $profile"); - GCUBEScope scope = aslSession.getScope(); + List appProfile = client.execute(query, scope.getInfrastructure()); if (appProfile == null || appProfile.size() == 0) @@ -151,6 +153,7 @@ public class SocialPortalBridge { throw new ApplicationProfileNotFoundException("Your applicationProfile URL was not found in the profile for Scope: " + scope.toString()); } else throw new ApplicationProfileNotFoundException("Your applicationProfile EndPoint was not found in the profile, consider adding element in "); + _log.debug("Returning " + toReturn); return toReturn; }