Class ResourceRegistryQueryTemplateClientImpl
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo
-
- org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistryQueryTemplateClientImpl
-
- All Implemented Interfaces:
org.gcube.informationsystem.resourceregistry.api.request.RequestInfo,ResourceRegistryQueryTemplateClient
public class ResourceRegistryQueryTemplateClientImpl extends org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo implements ResourceRegistryQueryTemplateClient
Default implementation ofResourceRegistryQueryTemplateClient, backed by HTTP calls to the Resource Registry service. Unlike the sibling Context/Schema clients, this implementation keeps no local cache: every operation is a direct round-trip to the server.- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected StringaddressThe base address of the Resource Registry Query Template serviceprotected Map<String,String>headersAdditional HTTP headers to be included in requestsprotected booleanpolymorphicWhetherrun(java.lang.String)executes a query template's underlying query polymorphically (including subtypes).
-
Constructor Summary
Constructors Constructor Description ResourceRegistryQueryTemplateClientImpl(String address)Creates a new ResourceRegistryQueryTemplateClientImpl instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddHeader(String name, boolean value)Adds a custom HTTP header to be included in requests.voidaddHeader(String name, String value)Adds a custom HTTP header to be included in requests.List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate>all()Retrieves all query templates from the Resource Registry.Stringcreate(String queryTemplate)Deprecated.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplatecreate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Deprecated.StringcreateOrUpdate(String queryTemplate)Creates a new query template, or updates the existing one with the same name (versioned upsert), from its JSON representation, which is sent as it is.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplatecreateOrUpdate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Creates a new query template, or updates the existing one with the same name (versioned upsert).booleandelete(String queryTemplateName)Deletes an existing query template from the Resource Registry by its name.booleandelete(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Deletes an existing query template from the Resource Registry.booleanexist(String queryTemplateName)Checks if a query template exists in the Resource Registry using template name.booleanexist(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Checks if a query template exists in the Resource Registry.protected org.gcube.common.gxhttp.request.GXRequestgetGXRequest()Creates and configures a new HTTP request with authorization headers and custom headers.booleanisPolymorphic()WhetherResourceRegistryQueryTemplateClient.run(java.lang.String)executes a query template's underlying query polymorphically (including subtypes).StringjsonQuery(String query)Executes a JSON Query against the Query Template collection itself (e.g.List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate>jsonQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)Executes a JSON Query against the Query Template collection itself and deserializes the matching definitions.List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate>query(String query)Executes a JSON Query against the Query Template collection itself and returns the matching definitions.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplateread(String queryTemplateName)Reads an existing query template from the Resource Registry by its name.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplateread(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Reads an existing query template from the Resource Registry using a provided template object.StringreadAsString(String queryTemplateName)Reads an existing query template from the Resource Registry as JSON string.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>run(String name)Executes the named query template with no parameters.Stringrun(String name, String params)Executes the named query template, substituting the given JSON parameter values into its template variables.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>run(String name, org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)Executes the named query template, substituting the given parameter values.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>run(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Executes the query template with no parameters; the name is taken from the givenQueryTemplate.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>run(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate, org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)Executes the query template, substituting the given parameter values; the name is taken from the givenQueryTemplate.StringrunGetString(String name)Executes the named query template with no parameters and returns the results as a JSON array string.voidsetPolymorphic(boolean polymorphic)Configures whetherResourceRegistryQueryTemplateClient.run(java.lang.String)executes a query template's underlying query polymorphically (including subtypes).Stringupdate(String queryTemplate)Deprecated.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplateupdate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate)Deprecated.-
Methods inherited from class org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo
allMeta, getContextsPolicy, getLimit, getMembershipScope, getOffset, includeMeta, isHierarchicalMode, setAllMeta, setContextsPolicy, setHierarchicalMode, setIncludeMeta, setLimit, setMembershipScope, setOffset
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
allMeta, getContextsPolicy, getLimit, getMembershipScope, getOffset, includeMeta, isHierarchicalMode, serverResponses, setAllMeta, setContextsPolicy, setHierarchicalMode, setIncludeMeta, setLimit, setMembershipScope, setOffset
-
Methods inherited from interface org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistryQueryTemplateClient
list
-
-
-
-
Field Detail
-
address
protected final String address
The base address of the Resource Registry Query Template service
-
polymorphic
protected boolean polymorphic
Whetherrun(java.lang.String)executes a query template's underlying query polymorphically (including subtypes).
-
-
Constructor Detail
-
ResourceRegistryQueryTemplateClientImpl
public ResourceRegistryQueryTemplateClientImpl(String address)
Creates a new ResourceRegistryQueryTemplateClientImpl instance.- Parameters:
address- The base address of the Resource Registry Query Template service
-
-
Method Detail
-
addHeader
public void addHeader(String name, String value)
Adds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
addHeaderin interfaceResourceRegistryQueryTemplateClient- Parameters:
name- Header namevalue- Header value
-
addHeader
public void addHeader(String name, boolean value)
Adds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
addHeaderin interfaceResourceRegistryQueryTemplateClient- Parameters:
name- Header namevalue- boolean value
-
getGXRequest
protected org.gcube.common.gxhttp.request.GXRequest getGXRequest()
Creates and configures a new HTTP request with authorization headers and custom headers.- Returns:
- A configured GXRequest instance ready for use
-
isPolymorphic
public boolean isPolymorphic()
WhetherResourceRegistryQueryTemplateClient.run(java.lang.String)executes a query template's underlying query polymorphically (including subtypes). Default:true.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
isPolymorphicin interfaceResourceRegistryQueryTemplateClient- Returns:
- the currently configured polymorphic flag
-
setPolymorphic
public void setPolymorphic(boolean polymorphic)
Configures whetherResourceRegistryQueryTemplateClient.run(java.lang.String)executes a query template's underlying query polymorphically (including subtypes).Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
setPolymorphicin interfaceResourceRegistryQueryTemplateClient- Parameters:
polymorphic-trueto include subtypes (default),falsefor exact type match only
-
all
public List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate> all() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Retrieves all query templates from the Resource Registry.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(), including RFC 8288 paginationLinkheaders andX-Warning. Request options configured viaResourceRegistryRequestOptionsmay specify pagination (limit,offset) andmetadataPolicy.- Specified by:
allin interfaceResourceRegistryQueryTemplateClient- Returns:
- List of all query templates accessible to the current user, or an empty list if none exist
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template retrieval
-
createOrUpdate
public org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate createOrUpdate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionCreates a new query template, or updates the existing one with the same name (versioned upsert). The name is taken from the givenQueryTemplate, whoseversionandchangelogare sent as they are.The server creates the template when the name is absent, updates it when the submitted
versionis higher than the persisted one, and leaves it untouched when the sameversioncarries an identical definition. Every successful outcome returns the persisted representation.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specifymetadataPolicy.createOrUpdate(String)for implementation details.- Specified by:
createOrUpdatein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- the query template to create or update; must not benulland must have a non-blank name- Returns:
- the created/updated query template, as returned by the server
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- if the submitted definition conflicts with the persisted one (sameversionwith a different definition, lower or insufficiently advancedversion, alteredchangeloghistory, differentid)org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the template definition is invalid or the operation fails
-
createOrUpdate
public String createOrUpdate(String queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Creates a new query template, or updates the existing one with the same name (versioned upsert), from its JSON representation, which is sent as it is. The name is taken from the JSONnameproperty. SeeResourceRegistryQueryTemplateClient.createOrUpdate(QueryTemplate)for the outcomes.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specifymetadataPolicy.- Specified by:
createOrUpdatein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- JSON representation of the query template to create or update; must not benullor blank- Returns:
- JSON representation of the created/updated query template, as returned by the server
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- if the submitted definition conflicts with the persisted one (sameversionwith a different definition, lower or insufficiently advancedversion, alteredchangeloghistory, differentid)org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the template definition is invalid or the operation fails
-
exist
public boolean exist(String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Checks if a query template exists in the Resource Registry using template name.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
existin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplateName- The name of the query template to check for existence; must not benullor blank- Returns:
- true if the query template exists and is accessible, false if not found
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during the existence check
-
exist
public boolean exist(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionChecks if a query template exists in the Resource Registry.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses().exist(String)for implementation details.- Specified by:
existin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- The query template to check for existence; must not benulland must have a valid name- Returns:
- true if the query template exists and is accessible, false if not found
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during the existence check
-
read
public org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate read(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReads an existing query template from the Resource Registry using a provided template object.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specifymetadataPolicy.read(String)for implementation details.- Specified by:
readin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- Template object containing at least the name; must not benull- Returns:
- The complete query template from the Resource Registry
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template is found with the specified nameorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during template retrieval
-
read
public org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate read(String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Reads an existing query template from the Resource Registry by its name.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(), including canonicalContent-Location,Link: rel="collection", andX-Warning. Request options configured viaResourceRegistryRequestOptionsmay specifymetadataPolicy.readAsString(String)for implementation details.- Specified by:
readin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplateName- The name of the query template to read; must not benullor blank- Returns:
- The complete query template from the Resource Registry
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template is found with the specified nameorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during template retrieval
-
readAsString
public String readAsString(String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Reads an existing query template from the Resource Registry as JSON string.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(), including canonicalContent-Location,Link: rel="collection", andX-Warning. Request options configured viaResourceRegistryRequestOptionsmay specifymetadataPolicy.- Specified by:
readAsStringin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplateName- The name of the query template to read; must not benullor blank- Returns:
- JSON representation of the complete query template from the Resource Registry
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template is found with the specified nameorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during template retrieval
-
runGetString
public String runGetString(String name) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the named query template with no parameters and returns the results as a JSON array string.Invocation-specific options and immutable response metadata are available through
This method is a convenience wrapper that delegates toRequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.run(String, String)with empty parameters for implementation details.- Specified by:
runGetStringin interfaceResourceRegistryQueryTemplateClient- Parameters:
name- the name of the query template to execute; must not benullor blank- Returns:
- JSON array string containing the query results, or empty array string "[]" if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
run
public <E extends org.gcube.informationsystem.model.reference.ERElement> List<E> run(String name) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the named query template with no parameters. SeeResourceRegistryQueryTemplateClient.runGetString(String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.runGetString(String)for implementation details.- Specified by:
runin interfaceResourceRegistryQueryTemplateClient- Type Parameters:
E- the expected Information System element type- Parameters:
name- the name of the query template to execute; must not benullor blank- Returns:
- the query results, deserialized, or an empty list if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
run
public <E extends org.gcube.informationsystem.model.reference.ERElement> List<E> run(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the query template with no parameters; the name is taken from the givenQueryTemplate. SeeResourceRegistryQueryTemplateClient.runGetString(String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.run(String)for implementation details.- Specified by:
runin interfaceResourceRegistryQueryTemplateClient- Type Parameters:
E- the expected Information System element type- Parameters:
queryTemplate- the query template to execute (only its name is used); must not benull- Returns:
- the query results, deserialized, or an empty list if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
run
public String run(String name, String params) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the named query template, substituting the given JSON parameter values into its template variables. SeeResourceRegistryQueryTemplateClient.runGetString(String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.- Specified by:
runin interfaceResourceRegistryQueryTemplateClient- Parameters:
name- the name of the query template to execute; must not benullor blankparams- JSON object with parameter values for template substitution, ornull/empty for defaults; parameters omitted fall back to their declared default value, if any- Returns:
- JSON array string containing the query results, or empty array string "[]" if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
run
public <E extends org.gcube.informationsystem.model.reference.ERElement> List<E> run(String name, org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the named query template, substituting the given parameter values. SeeResourceRegistryQueryTemplateClient.run(String, String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.run(String, String)for implementation details.- Specified by:
runin interfaceResourceRegistryQueryTemplateClient- Type Parameters:
E- the expected Information System element type- Parameters:
name- the name of the query template to execute; must not benullor blankjsonNode- parameter values for template substitution, ornullfor defaults- Returns:
- the query results, deserialized, or an empty list if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
run
public <E extends org.gcube.informationsystem.model.reference.ERElement> List<E> run(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate, org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes the query template, substituting the given parameter values; the name is taken from the givenQueryTemplate. SeeResourceRegistryQueryTemplateClient.run(String, String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Client options andResourceRegistryRequestOptionsconfigurepolymorphic,hierarchicalMode,contextsPolicy,membershipScope,metadataPolicy,limit, andoffset.run(String, JsonNode)for implementation details.- Specified by:
runin interfaceResourceRegistryQueryTemplateClient- Type Parameters:
E- the expected Information System element type- Parameters:
queryTemplate- the query template to execute (only its name is used); must not benulljsonNode- parameter values for template substitution, ornullfor defaults- Returns:
- the query results, deserialized, or an empty list if no results match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- if no query template with the given name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the execution fails
-
delete
public boolean delete(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDeletes an existing query template from the Resource Registry.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses().delete(String)for implementation details.- Specified by:
deletein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- The query template to delete (must have a valid name); must not benull- Returns:
- true if the query template was successfully deleted
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template is found with the specified nameorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during template deletion
-
delete
public boolean delete(String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Deletes an existing query template from the Resource Registry by its name.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses().- Specified by:
deletein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplateName- The name of the query template to delete; must not benullor blank- Returns:
- true if the query template was successfully deleted
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template is found with the specified nameorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during template deletion
-
jsonQuery
public String jsonQuery(String query) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes a JSON Query against the Query Template collection itself (e.g. by name), as opposed toResourceRegistryQueryTemplateClient.run(String), which executes a named template's own stored query.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specify pagination (limit,offset) andmetadataPolicy.- Specified by:
jsonQueryin interfaceResourceRegistryQueryTemplateClient- Parameters:
query- JSON object describing the Query Template structure to search for; must not benullor blank- Returns:
- JSON array string of matching query template definitions, or empty array string "[]" if none match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the query syntax is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the lookup fails
-
jsonQuery
public List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate> jsonQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes a JSON Query against the Query Template collection itself and deserializes the matching definitions. SeeResourceRegistryQueryTemplateClient.jsonQuery(String)for the underlying contract.Invocation-specific options and immutable response metadata are available through
This method is a type-safe wrapper that delegates toRequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specify pagination (limit,offset) andmetadataPolicy.jsonQuery(String)for implementation details.- Specified by:
jsonQueryin interfaceResourceRegistryQueryTemplateClient- Parameters:
jsonNode- JsonNode describing the Query Template structure to search for; must not benull- Returns:
- the matching query template definitions, or an empty list if none match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the query syntax is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the lookup fails
-
query
public List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate> query(String query) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Executes a JSON Query against the Query Template collection itself and returns the matching definitions.Convenience alias delegating to
ResourceRegistryQueryTemplateClient.jsonQuery(String)followed by deserialization to a list ofQueryTemplateentities.Invocation-specific options and immutable response metadata are available through
RequestInfo.serverResponses(). Request options configured viaResourceRegistryRequestOptionsmay specify pagination (limit,offset) andmetadataPolicy.- Specified by:
queryin interfaceResourceRegistryQueryTemplateClient- Parameters:
query- JSON Query-By-Example string describing the Query Template structure to search for; must not benullor blank- Returns:
- a list of matching query templates, or an empty list if no query templates match
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the query syntax is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the lookup fails or an error occurs during retrieval
-
create
@Deprecated public org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate create(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Deprecated.Creates the Query Template; the Resource Registry 6.0.0 has one versioned upsert.- Specified by:
createin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- the Query Template- Returns:
- the Query Template as stored
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- if the stored version conflicts with the submitted oneorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
create
@Deprecated public String create(String queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Deprecated.Creates the Query Template; the Resource Registry 6.0.0 has one versioned upsert.- Specified by:
createin interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- the JSON representation of the Query Template- Returns:
- the JSON representation of the Query Template as stored
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- if the stored version conflicts with the submitted oneorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
update
@Deprecated public org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate update(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Deprecated.Updates the Query Template; the Resource Registry 6.0.0 has one versioned upsert.- Specified by:
updatein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- the Query Template- Returns:
- the Query Template as stored
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- never thrown by the upsert, kept for the callers of the previous releasesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
update
@Deprecated public String update(String queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
Deprecated.Updates the Query Template; the Resource Registry 6.0.0 has one versioned upsert.- Specified by:
updatein interfaceResourceRegistryQueryTemplateClient- Parameters:
queryTemplate- the JSON representation of the Query Template- Returns:
- the JSON representation of the Query Template as stored
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- never thrown by the upsert, kept for the callers of the previous releasesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
-