From 58771ce3cacea6d85967c6131227bae91a10b4c5 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Thu, 13 Dec 2012 13:56:08 +0000 Subject: [PATCH] enriched application profile git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@62300 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../social/ApplicationNewsManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java index 38e8785..084af68 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java @@ -12,6 +12,7 @@ import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.informationsystem.client.ISClient; import org.gcube.common.core.informationsystem.client.XMLResult; import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery; +import org.gcube.common.core.scope.GCUBEScope; import org.gcube.portal.databook.shared.Application; import org.gcube.portal.databook.shared.Feed; import org.gcube.portal.databook.shared.FeedType; @@ -54,7 +55,9 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa " eq '" + applicationClass.getName() + "'" + "return $profile"); - List appProfile = client.execute(query, aslSession.getScope().getInfrastructure()); + GCUBEScope scope = aslSession.getScope(); + + List appProfile = client.execute(query, scope.getInfrastructure()); if (appProfile == null || appProfile.size() == 0) throw new ApplicationProfileNotFoundException("Your application is not registered in the infrastructure"); else { @@ -83,6 +86,17 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa toReturn.setImageUrl(currValue.get(0)); } else throw new ApplicationProfileNotFoundException("Your application Image Url was not found in the profile, consider adding element in "); + currValue = node.evaluate("/Resource/Profile/Body/EndPoint/Scope/text()"); + if (currValue != null && currValue.size() > 0) { + List scopes = currValue; + for (int i = 0; i < scopes.size(); i++) + if (currValue.get(i).trim().compareTo(scope.toString()) == 0) { + toReturn.setUrl(node.evaluate("/Resource/Profile/Body/EndPoint/URL/text()").get(i)); + toReturn.setScope(scope.toString()); + } else + throw new ApplicationProfileNotFoundException("Your application EndPoint URL was not found in the profile, consider adding $scopeMyAppurl element in "); + } + else throw new ApplicationProfileNotFoundException("Your application EndPoint was not found in the profile, consider adding element in "); return toReturn; }