fix for wsresource by subtype query

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@81523 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-09-16 09:38:20 +00:00
parent bfcf92aef9
commit 8a52b59368
4 changed files with 18 additions and 14 deletions

View File

@ -350,6 +350,7 @@ public class ISClientRequester {
try { try {
if (type.equals(ResourceTypeDecorator.WSResource.name())) { if (type.equals(ResourceTypeDecorator.WSResource.name())) {
queryPath = QueryLocation.GET_WSRES_DETAILS_BYSUBTYPE; queryPath = QueryLocation.GET_WSRES_DETAILS_BYSUBTYPE;
returnPath = QueryLocation.valueOf("RETURN_" + QueryLocation.GET_WSRES_DETAILS_BYSUBTYPE);
} else { } else {
queryPath = QueryLocation.valueOf("LIST_" + type); queryPath = QueryLocation.valueOf("LIST_" + type);
returnPath = QueryLocation.valueOf("RETURN_" + type); returnPath = QueryLocation.valueOf("RETURN_" + type);
@ -380,8 +381,9 @@ public class ISClientRequester {
isQuery.addParameter("RES_SUBTYPE", "where $subtype = \"" + subType.trim() + "\""); isQuery.addParameter("RES_SUBTYPE", "where $subtype = \"" + subType.trim() + "\"");
} }
} }
String retParam = type.equals(ResourceTypeDecorator.WSResource.name()) ? "WSRESOURCE" : "RESOURCE";
//add the return statement //add the return statement
isQuery.addParameter("RESOURCE", QueryLoader.getQuery(returnPath)); isQuery.addParameter(retParam, QueryLoader.getQuery(returnPath));
ISQueryCacheKeyT cacheKey = new ISQueryCacheKeyT(queryScope.toString(), isQuery.expression(), "getResourcesTypes"); ISQueryCacheKeyT cacheKey = new ISQueryCacheKeyT(queryScope.toString(), isQuery.expression(), "getResourcesTypes");

View File

@ -78,6 +78,7 @@ public enum QueryLocation {
GET_WSRES_TYPES("getWSResourcesTypes.xq"), GET_WSRES_TYPES("getWSResourcesTypes.xq"),
GET_WSRES_DETAILS_BYTYPE("getWSResourcesDetails.xq"), GET_WSRES_DETAILS_BYTYPE("getWSResourcesDetails.xq"),
GET_WSRES_DETAILS_BYSUBTYPE("getWSResourcesDetailsSubType.xq"), GET_WSRES_DETAILS_BYSUBTYPE("getWSResourcesDetailsSubType.xq"),
RETURN_GET_WSRES_DETAILS_BYSUBTYPE("RETURN_getWSResourcesDetailsSubType.xq"),
GET_WSRESOURCE_BYID("getWSResourceByID.xq"); GET_WSRESOURCE_BYID("getWSResourceByID.xq");
private final String path = "org/gcube/resourcemanagement/support/server/gcube/queries/xquery/"; private final String path = "org/gcube/resourcemanagement/support/server/gcube/queries/xquery/";

View File

@ -0,0 +1,13 @@
<WSResource>
{$outer//Document/ID}
{$outer//Document/Source}
{$outer//Document/SourceKey}
<ServiceClass>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</ServiceClass>
<ServiceName>{$outer//Document/Data/child::*[local-name()='ServiceName']/text()}</ServiceName>
<SubType>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</SubType>
{$outer//Document/TerminationTimeHuman}
{$outer//Document/LastUpdateHuman}
<RI>{$outer//Document/Data/child::*[local-name()='RI']/text()}</RI>
<Type>WSResource</Type>
<scopes>{$scopes}</scopes>
</WSResource>

View File

@ -2,16 +2,4 @@ for $outer in collection("/db/Properties")//Document
let $scopes := string-join( $outer//Document/Data/child::*[local-name()='Scope']/text(), ';') let $scopes := string-join( $outer//Document/Data/child::*[local-name()='Scope']/text(), ';')
where $outer//Document/Data/child::*[local-name()='ServiceClass']/text() eq '<RES_SUBTYPE/>' where $outer//Document/Data/child::*[local-name()='ServiceClass']/text() eq '<RES_SUBTYPE/>'
return return
<WSResource> <WSRESOURCE/>
{$outer//Document/ID}
{$outer//Document/Source}
{$outer//Document/SourceKey}
<ServiceClass>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</ServiceClass>
<ServiceName>{$outer//Document/Data/child::*[local-name()='ServiceName']/text()}</ServiceName>
<SubType>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</SubType>
{$outer//Document/TerminationTimeHuman}
{$outer//Document/LastUpdateHuman}
<RI>{$outer//Document/Data/child::*[local-name()='RI']/text()}</RI>
<Type>WSResource</Type>
<scopes>{$scopes}</scopes>
</WSResource>