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
This commit is contained in:
Massimiliano Assante 2012-12-13 13:56:08 +00:00
parent 394971d6bf
commit 58771ce3ca
1 changed files with 15 additions and 1 deletions

View File

@ -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<XMLResult> appProfile = client.execute(query, aslSession.getScope().getInfrastructure());
GCUBEScope scope = aslSession.getScope();
List<XMLResult> 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 <ThumbnailURL> element in <Body>");
currValue = node.evaluate("/Resource/Profile/Body/EndPoint/Scope/text()");
if (currValue != null && currValue.size() > 0) {
List<String> 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 <EndPoint><Scope>$scope</Scope><URL>MyAppurl</URL> element in <Body>");
}
else throw new ApplicationProfileNotFoundException("Your application EndPoint was not found in the profile, consider adding <EndPoint><Scope> element in <Body>");
return toReturn;
}