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
This commit is contained in:
Massimiliano Assante 2013-06-10 16:31:20 +00:00
parent 85b745f84a
commit 10a029ab7b
2 changed files with 15 additions and 12 deletions

View File

@ -12,7 +12,6 @@ import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationChannelType; import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType; import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portal.databook.shared.RunningJob; 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.exceptions.InternalErrorException;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem; import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
@ -37,6 +36,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
*/ */
public ApplicationNotificationsManager(ASLSession session) { public ApplicationNotificationsManager(ASLSession session) {
super(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, * 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 userIdToNotify, //user no notify
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
"?oid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"shared the workspace folder "+ sharedFolder.getName() +" with you", "shared the workspace folder "+ sharedFolder.getName() +" with you",
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -127,7 +127,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
renamedFolderId, //the renamedFolderId, //the
new Date(), new Date(),
"?oid="+renamedFolderId, getApplicationUrl()+"?itemid="+renamedFolderId,
"renamed your shared folder "+ previousName +" as " + newName, "renamed your shared folder "+ previousName +" as " + newName,
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -152,7 +152,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
"?oid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"added "+ user.getFullname() +" to your workspace shared folder "+ sharedFolder.getName(), "added "+ user.getFullname() +" to your workspace shared folder "+ sharedFolder.getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -183,7 +183,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
"?oid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"added "+ addedUsersFullNames +" to your workspace shared folder "+ sharedFolder.getName(), "added "+ addedUsersFullNames +" to your workspace shared folder "+ sharedFolder.getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -206,7 +206,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
sharedFolder.getId(), //the sharedFolder.getId(), //the
new Date(), new Date(),
"?oid="+sharedFolder.getId(), getApplicationUrl()+"?itemid="+sharedFolder.getId(),
"unshared his shared folder "+ sharedFolder.getName() + " from your workspace", "unshared his shared folder "+ sharedFolder.getName() + " from your workspace",
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -227,7 +227,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
item.getId(), //the item.getId(), //the
new Date(), new Date(),
"?oid="+item.getId()+"&parentoid="+item.getParent().getId(), getApplicationUrl()+"?itemid="+item.getParent().getId(),
"added "+ item.getName() +" to your workspace shared folder "+ sharedFolder.getName(), "added "+ item.getName() +" to your workspace shared folder "+ sharedFolder.getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -248,8 +248,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
item.getId(), //the item.getId(), //the
new Date(), new Date(),
"?oid="+item.getId()+"&parentoid="+item.getParent().getId(), getApplicationUrl()+"?itemid="+item.getParent().getId(),
"removed "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName(), "removed item "+ item.getName() +" from your workspace shared folder "+ sharedFolder.getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),
aslSession.getUserFullName(), aslSession.getUserFullName(),
@ -269,7 +269,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
item.getId(), //the item.getId(), //the
new Date(), 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(), " updated "+ item.getName() +" to your workspace shared folder "+ item.getParent().getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),
@ -290,7 +290,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
userIdToNotify, //user no notify userIdToNotify, //user no notify
renamedItem.getId(), //the renamedItem.getId(), //the
new Date(), new Date(),
"?oid="+renamedItem.getId(), getApplicationUrl()+"?itemid="+renamedItem.getParent().getId(),
"renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName(), "renamed " + previousName +" as " + renamedItem.getName() +" in your shared folder " + renamedItem.getParent().getName(),
false, false,
aslSession.getUsername(), aslSession.getUsername(),

View File

@ -93,6 +93,8 @@ public class SocialPortalBridge {
* @return the applicationProfile profile * @return the applicationProfile profile
*/ */
private ApplicationProfile getProfileFromInfrastrucure(String portletClassName) { private ApplicationProfile getProfileFromInfrastrucure(String portletClassName) {
GCUBEScope scope = aslSession.getScope();
_log.debug("Trying to fetch applicationProfile profile from the infrastructure for " + portletClassName + " scope: " + scope);
try { try {
ApplicationProfile toReturn = new ApplicationProfile(); ApplicationProfile toReturn = new ApplicationProfile();
ISClient client = GHNContext.getImplementation(ISClient.class); ISClient client = GHNContext.getImplementation(ISClient.class);
@ -104,7 +106,7 @@ public class SocialPortalBridge {
" eq '" + portletClassName + "'" + " eq '" + portletClassName + "'" +
"return $profile"); "return $profile");
GCUBEScope scope = aslSession.getScope();
List<XMLResult> appProfile = client.execute(query, scope.getInfrastructure()); List<XMLResult> appProfile = client.execute(query, scope.getInfrastructure());
if (appProfile == null || appProfile.size() == 0) 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()); 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 <EndPoint><Scope> element in <Body>"); else throw new ApplicationProfileNotFoundException("Your applicationProfile EndPoint was not found in the profile, consider adding <EndPoint><Scope> element in <Body>");
_log.debug("Returning " + toReturn);
return toReturn; return toReturn;
} }