rmp-common-library/src/main/java/org/gcube/resourcemanagement/support/server/gcube/queries/xquery/resources/RunningInstance.xq

26 lines
1.1 KiB
Plaintext

for $profiles in collection('/db/Profiles/RunningInstance')//Resource
<!--
let $ghn-name := $profiles/Profile/GHN/@UniqueID/string()
-->
let $ghns := collection('/db/Profiles/GHN')//Resource
let $_ghn-name := for $ghn in $ghns
where $ghn/ID/string() eq $profiles/Profile/GHN/@UniqueID/string()
return $ghn/Profile/GHNDescription/Name/string()
let $ghn-name := if (empty($_ghn-name)) then $profiles/Profile/GHN/@UniqueID/string() else $_ghn-name
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
let $subtype := $profiles/Profile/ServiceClass/text()
<RES_SUBTYPE ISdefault =''/>
return
<Resource>
{$profiles/ID}
<Type>{$profiles/Type/text()}</Type>
<SubType>{$subtype}</SubType>
<Scopes>{$scopes}</Scopes>
<ServiceClass>{$profiles/Profile/ServiceClass/text()}</ServiceClass>
<ServiceName>{$profiles/Profile/ServiceName/text()}</ServiceName>
<Version>{$profiles/Profile/Version/text()}</Version>
<Status>{$profiles/Profile/DeploymentData/Status/text()}</Status>
<ghn-name>{$ghn-name}</ghn-name>
</Resource>