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
Feature/25384
Massimiliano Assante 11 years ago
parent bfcf92aef9
commit 8a52b59368

@ -350,6 +350,7 @@ public class ISClientRequester {
try {
if (type.equals(ResourceTypeDecorator.WSResource.name())) {
queryPath = QueryLocation.GET_WSRES_DETAILS_BYSUBTYPE;
returnPath = QueryLocation.valueOf("RETURN_" + QueryLocation.GET_WSRES_DETAILS_BYSUBTYPE);
} else {
queryPath = QueryLocation.valueOf("LIST_" + type);
returnPath = QueryLocation.valueOf("RETURN_" + type);
@ -380,8 +381,9 @@ public class ISClientRequester {
isQuery.addParameter("RES_SUBTYPE", "where $subtype = \"" + subType.trim() + "\"");
}
}
String retParam = type.equals(ResourceTypeDecorator.WSResource.name()) ? "WSRESOURCE" : "RESOURCE";
//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");

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

@ -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>

@ -2,16 +2,4 @@ for $outer in collection("/db/Properties")//Document
let $scopes := string-join( $outer//Document/Data/child::*[local-name()='Scope']/text(), ';')
where $outer//Document/Data/child::*[local-name()='ServiceClass']/text() eq '<RES_SUBTYPE/>'
return
<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>
<WSRESOURCE/>

Loading…
Cancel
Save