Interface ResourceRegistryQueryTemplateClient
- All Superinterfaces:
org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
- All Known Implementing Classes:
ResourceRegistryQueryTemplateClientImpl
public interface ResourceRegistryQueryTemplateClient
extends org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
Client interface for managing query templates in the Resource Registry system.
Purpose:
This interface provides methods for creating, reading, updating, deleting, and executing query templates
within the Resource Registry. Query templates allow users to define reusable parameterized queries
for complex data retrieval operations on Information System model instances.
Instantiation:
Clients should be created using the factory pattern for proper configuration:
// Recommended way to create a client ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create();Supported Operations:
- CRUD Operations: Create, Read, Update, Delete query templates with full lifecycle management
- Template Execution: Execute parameterized queries with variable substitution
- List Operations: Retrieve all available query templates with filtering and pagination
- Validation: Validate template syntax and parameter bindings before execution.
- Support for variable substitution using placeholder syntax
- Type-safe parameter binding and validation
- Complex queries spanning multiple entity and relation types
- Result filtering and transformation capabilities.
- includeMeta: Include metadata in template and result responses
- limit: Maximum number of templates or results per request
- offset: Number of items to skip for pagination.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields inherited from interface org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
DEFAULT_LIMIT, DEFAULT_OFFSET, UNBOUNDED_LIMIT -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a custom HTTP header to be included in requests.voidAdds 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.Creates a new query template from JSON representation in the Resource Registry.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplatecreate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) Creates a new query template in the Resource Registry.booleanDeletes 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.booleanChecks 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.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplateReads 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.readAsString(String queryTemplateName) Reads an existing query template from the Resource Registry as JSON string.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>Executes a query template and returns results as a list of Information System elements.Executes a query template with string parameters and returns results as JSON string.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>Executes a query template with JsonNode parameters and returns results as a list of Information System elements.<E extends org.gcube.informationsystem.model.reference.ERElement>
List<E>run(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) Executes a query template using template object and returns results as a list of Information System elements.<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 a query template using template object with JsonNode parameters and returns results as a list of Information System elements.runGetString(String name) Executes a query template and returns results as JSON string.Updates an existing query template from JSON representation in the Resource Registry.org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplateupdate(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) Updates an existing query template in the Resource Registry.Methods inherited from interface org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
allMeta, getLimit, getOffset, includeContexts, includeMeta, isHierarchicalMode, setAllMeta, setHierarchicalMode, setIncludeContexts, setIncludeMeta, setLimit, setOffset
-
Method Details
-
addHeader
Adds a custom HTTP header to be included in requests.- Parameters:
name- Header namevalue- Header value
-
addHeader
Adds a custom HTTP header to be included in requests.- Parameters:
name- Header namevalue- boolean value
-
all
List<org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate> all() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionRetrieves all query templates from the Resource Registry. Corresponding REST API:GET /query-templates[?limit={number}&offset={number}&includeMeta={true|false}]Operation Behavior:- Returns all query templates accessible to the current user
- Results are filtered based on user authorization
- Provides pagination support via limit and offset parameters
- Can include metadata with role-based filtering when requested.
- 200 OK: Query templates successfully retrieved
- 400 Bad Request: Invalid query parameters (e.g., invalid limit/offset values)
- 403 Forbidden: Insufficient permissions to access query templates
- 401 Unauthorized: Invalid or missing authentication credentials.
- Maximum number of query templates to return in a single response
- Default value: 10
- Usage:
client.setLimit(50) - Example: Set to 50 to get at most 50 query templates per request
- Unlimited results: Set to
RequestInfo.UNBOUNDED_LIMIT(-1) for unlimited results (may cause timeout if results are too many) - Query parameter:
QueryTemplatePath.LIMIT_QUERY_PARAMETER.
- Number of query templates to skip from the beginning of the result set
- Default value: 0
- Usage:
client.setOffset(10) - Example: Set to 100 to skip the first 100 query templates (useful for pagination)
- Query parameter:
QueryTemplatePath.OFFSET_QUERY_PARAMETER.
- Whether to include metadata in the response query templates
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- No input parameters required for this operation
- All available query templates are retrieved based on user authorization.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to all query templates with complete, unfiltered metadata including all administrative fields
- Infrastructure-Manager: Full access to all query templates with complete, unfiltered metadata including all administrative fields
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Get all query templates with default pagination List<QueryTemplate> templates = client.all(); // Get query templates with custom pagination and metadata client.setLimit(20); client.setOffset(40); client.setIncludeMeta(true); List<QueryTemplate> templatesWithMeta = client.all();
- Returns:
- List of all query templates accessible to the current user
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template retrieval
-
create
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 Creates a new query template in the Resource Registry. Corresponding REST API:PUT /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Creates a new query template if no template with the same name exists
- If a template with the same name already exists, throws
QueryTemplateAlreadyPresentException - Validates the query template definition including query syntax and parameter declarations
- Performs automatic query validation using default parameter values
- Returns the created template with server-generated metadata.
- 201 Created: Query template successfully created
- 400 Bad Request: Invalid query template definition, malformed JSON, or query validation failure
- 409 Conflict: Query template with the same name already exists
- 403 Forbidden: Insufficient permissions to create query templates
- 401 Unauthorized: Invalid or missing authentication credentials.
- Whether to include metadata in the response query template
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Query validation is performed using default values from templateVariables
- Every parameter used in the query (prefixed with $) must have a corresponding declaration in templateVariables
- Default values must be valid for query execution.
- Query template structure is validated against the QueryTemplate model
- Query syntax is validated by attempting execution with default parameter values
- The query must execute without errors (empty results are acceptable)
- Parameter declarations must match parameters used in the query.
- Query templates are global and not bound to a specific context.
- IS-Manager: Full access to create any query template with complete, unfiltered metadata in response
- Infrastructure-Manager: Full access to create any query template with complete, unfiltered metadata in response
- All Other Users: Limited create permissions based on context access; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Create a new query template QueryTemplate template = new QueryTemplate(); template.setName("GetAllEServiceWithState"); template.setDescription("Retrieves all EService instances with a specific state"); template.setQuery("SELECT FROM EService WHERE state = $state"); // ... set templateVariables and other properties QueryTemplate createdTemplate = client.create(template);- Parameters:
queryTemplate- The query template to create in the Resource Registry- Returns:
- The created query template with server-generated metadata
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- If a query template with the same name already existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template creation or validation
-
create
String create(String queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new query template from JSON representation in the Resource Registry. Corresponding REST API:PUT /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Creates a new query template from JSON if no template with the same name exists
- If a template with the same name already exists, throws
QueryTemplateAlreadyPresentException - Validates the JSON against the QueryTemplate model schema
- Performs automatic query validation using default parameter values
- The template name is extracted from the JSON "name" property
- Returns the created template as JSON with server-generated metadata.
- 201 Created: Query template successfully created
- 400 Bad Request: Invalid JSON data, schema validation failure, or query validation failure
- 409 Conflict: Query template with the same name already exists
- 403 Forbidden: Insufficient permissions to create query templates
- 401 Unauthorized: Invalid or missing authentication credentials.
- Must contain a valid "name" property specifying the query template name
- Must conform to the QueryTemplate model JSON schema
- Must include "query" property with valid query syntax
- TemplateVariables must be properly defined for all query parameters
- All required properties for QueryTemplate must be present.
- JSON structure is validated against the QueryTemplate model
- Query syntax is validated by attempting execution with default parameter values
- The query must execute without errors (empty results are acceptable)
- Parameter declarations must match parameters used in the query.
- Query templates are global and not bound to a specific context.
- IS-Manager: Full access to create any query template with complete, unfiltered metadata in response
- Infrastructure-Manager: Full access to create any query template with complete, unfiltered metadata in response
- All Other Users: Limited create permissions based on context access; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Create a new query template from JSON String templateJson = "{\"name\":\"GetAllEServiceWithState\",\"description\":\"...\",\"query\":\"SELECT FROM EService WHERE state = $state\",\"templateVariables\":{...}}"; String createdTemplateJson = client.create(templateJson);- Parameters:
queryTemplate- JSON representation of the query template to create- Returns:
- JSON representation of the created query template with server-generated metadata
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException- If a query template with the same name already existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template creation, JSON parsing, or validation
-
exist
boolean exist(org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Checks if a query template exists in the Resource Registry. Corresponding REST API:GET /query-templates/{query-template-name}Operation Behavior:- Verifies the existence of the specified query template using its name
- The template name is automatically extracted from the provided
QueryTemplateobject - Does not return the template data, only confirms existence
- Checks accessibility based on user authorization.
- 200 OK: Query template exists and is accessible
- 404 Not Found: Query template does not exist
- 403 Forbidden: Query template exists but user lacks authorization to access it
- 401 Unauthorized: Invalid or missing authentication credentials.
- This operation does not use query parameters for existence checking
- Existence is determined by attempting to retrieve the template without metadata.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Only the name field is used for the existence check.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to check existence of any query template
- Infrastructure-Manager: Full access to check existence of any query template
- All Other Users: Basic access with metadata filtering; can check existence of accessible templates.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Check if a query template exists QueryTemplate template = new QueryTemplate(); template.setName("GetAllEServiceWithState"); boolean exists = client.exist(template);- Parameters:
queryTemplate- The query template to check for existence (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
-
exist
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. Corresponding REST API:GET /query-templates/{query-template-name}Operation Behavior:- Verifies the existence of the specified query template using its name
- Does not return the template data, only confirms existence
- Checks accessibility based on user authorization
- Most direct method when template name is already known.
- 200 OK: Query template exists and is accessible
- 404 Not Found: Query template does not exist
- 403 Forbidden: Query template exists but user lacks authorization to access it
- 401 Unauthorized: Invalid or missing authentication credentials.
- This operation does not use query parameters for existence checking
- Existence is determined by attempting to retrieve the template without metadata.
- Template name must be a valid query template name
- Template names are case-sensitive and must match exactly.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to check existence of any query template
- Infrastructure-Manager: Full access to check existence of any query template
- All Other Users: Basic access with metadata filtering; can check existence of accessible templates.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Check if a query template exists by name boolean exists = client.exist("GetAllEServiceWithState");- Parameters:
queryTemplateName- The name of the query template to check for existence- 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
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.ResourceRegistryException Reads an existing query template from the Resource Registry using a provided template object. Corresponding REST API:GET /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Retrieves an existing query template by extracting name from the provided template object
- The template must be accessible based on user authorization
- Returns the complete template with all properties and metadata
- The name is automatically determined from the provided template object.
- 200 OK: Query template successfully retrieved
- 404 Not Found: No query template found with the specified name
- 403 Forbidden: User lacks read permissions for the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Whether to include metadata in the response query template
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Only the name field is used for template retrieval.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- Infrastructure-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Read a query template using template object QueryTemplate template = new QueryTemplate(); template.setName("GetAllEServiceWithState"); QueryTemplate readTemplate = client.read(template);- Parameters:
queryTemplate- Template object containing at least the name- 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
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. Corresponding REST API:GET /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Retrieves an existing query template by its name
- The template must be accessible based on user authorization
- Returns the complete template with all properties and metadata
- Most direct method when template name is already known.
- 200 OK: Query template successfully retrieved
- 404 Not Found: No query template found with the specified name
- 403 Forbidden: User lacks read permissions for the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Whether to include metadata in the response query template
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- The specified name must be a valid query template name
- Template names are case-sensitive and must match exactly
- Name must correspond to an existing template.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- Infrastructure-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Read a query template by name QueryTemplate template = client.read("GetAllEServiceWithState");- Parameters:
queryTemplateName- The name of the query template to read- 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
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. Corresponding REST API:GET /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Retrieves an existing query template by its name
- The template must be accessible based on user authorization
- Returns the complete template as JSON with all properties and metadata
- Returns the response as a JSON object string.
- 200 OK: Query template successfully retrieved
- 404 Not Found: No query template found with the specified name
- 403 Forbidden: User lacks read permissions for the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Whether to include metadata in the response query template
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- The specified name must be a valid query template name
- Template names are case-sensitive and must match exactly
- Name must correspond to an existing template.
- Query templates are global resources accessible across contexts
- Access level depends on user role and authorization.
- IS-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- Infrastructure-Manager: Full access to retrieve any query template with complete, unfiltered metadata including all administrative fields
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Read a query template as JSON string String templateJson = client.readAsString("GetAllEServiceWithState");- Parameters:
queryTemplateName- The name of the query template to read- 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
-
update
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 Updates an existing query template in the Resource Registry. Corresponding REST API:PUT /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Updates an existing query template if a template with the same name exists
- If no template with the same name exists, throws
QueryTemplateNotFoundException - Validates the updated query template definition including query syntax and parameter declarations
- Performs automatic query validation using default parameter values
- Returns the updated template with server-generated metadata.
- 200 OK: Query template successfully updated
- 400 Bad Request: Invalid query template definition, malformed JSON, or query validation failure
- 404 Not Found: Query template with the specified name does not exist
- 403 Forbidden: Insufficient permissions to update query templates
- 401 Unauthorized: Invalid or missing authentication credentials.
- Whether to include metadata in the response query template
- Default value: false (basic information only)
- Usage:
client.setIncludeMeta(true) - Values: true (includes metadata with role-based filtering) | false (basic information only)
- Query parameter:
QueryTemplatePath.INCLUDE_META_QUERY_PARAMETER - Restriction: IS-Manager and Infrastructure-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Query validation is performed using default values from templateVariables
- Every parameter used in the query (prefixed with $) must have a corresponding declaration in templateVariables
- Default values must be valid for query execution.
- Query template structure is validated against the QueryTemplate model
- Query syntax is validated by attempting execution with default parameter values
- The query must execute without errors (empty results are acceptable)
- Parameter declarations must match parameters used in the query.
- Query templates are global and not bound to a specific context.
- IS-Manager: Full access to update any query template with complete, unfiltered metadata in response
- Infrastructure-Manager: Full access to update any query template with complete, unfiltered metadata in response
- All Other Users: Limited update permissions based on context access; receive metadata with sensitive information filtered when includeMeta=true.
- Query templates are global and not bound to a specific context.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Update an existing query template QueryTemplate template = client.read("GetAllEServiceWithState"); template.setDescription("Updated description for EService state query"); template.setQuery("SELECT FROM EService WHERE state = $state AND name LIKE $namePattern"); // ... update templateVariables and other properties QueryTemplate updatedTemplate = client.update(template);- Parameters:
queryTemplate- The query template to update in the Resource Registry- Returns:
- The updated query template with server-generated metadata
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template with the specified name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template update or validation
-
update
String update(String queryTemplate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Updates an existing query template from JSON representation in the Resource Registry. Corresponding REST API:PUT /query-templates/{query-template-name}[?includeMeta={true|false}]Operation Behavior:- Updates an existing query template from JSON if a template with the same name exists
- If no template with the same name exists, throws
QueryTemplateNotFoundException - Validates the JSON against the QueryTemplate model schema
- Performs automatic query validation using default parameter values
- The template name is extracted from the JSON "name" property
- Returns the updated template as JSON with server-generated metadata.
- 200 OK: Query template successfully updated
- 400 Bad Request: Invalid JSON data, schema validation failure, or query validation failure
- 404 Not Found: Query template with the specified name does not exist
- 403 Forbidden: Insufficient permissions to update query templates
- 401 Unauthorized: Invalid or missing authentication credentials.
- Must contain a valid "name" property specifying the query template name
- Must conform to the QueryTemplate model JSON schema
- Must include "query" property with valid query syntax
- TemplateVariables must be properly defined for all query parameters
- All required properties for QueryTemplate must be present.
- JSON structure is validated against the QueryTemplate model
- Query syntax is validated by attempting execution with default parameter values
- The query must execute without errors (empty results are acceptable)
- Parameter declarations must match parameters used in the query.
- Query templates are global and not bound to a specific context.
- IS-Manager: Full access to update any query template with complete, unfiltered metadata in response
- Infrastructure-Manager: Full access to update any query template with complete, unfiltered metadata in response
- All Other Users: Limited update permissions based on context access; receive metadata with sensitive information filtered when includeMeta=true.
- Query templates are global and not bound to a specific context.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Update an existing query template from JSON String updatedTemplateJson = "{\"name\":\"GetAllEServiceWithState\",\"description\":\"Updated description\",\"query\":\"SELECT FROM EService WHERE state = $state AND name LIKE $namePattern\",\"templateVariables\":{...}}"; String updatedResult = client.update(updatedTemplateJson);- Parameters:
queryTemplate- JSON representation of the query template to update- Returns:
- JSON representation of the updated query template with server-generated metadata
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If no query template with the specified name existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template update, JSON parsing, or validation
-
runGetString
String runGetString(String name) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Executes a query template and returns results as JSON string. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the specified query template with no parameters
- Returns query results as a JSON array string
- Uses default parameter values if the template defines any parameters
- Results are filtered based on user authorization and context access.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution or parameter values
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Query execution respects context boundaries based on user authorization.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute a query template and get results as JSON String resultsJson = client.runGetString("GetAllEService");- Parameters:
name- The name of the query template to execute- Returns:
- JSON array string containing query results
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
run
<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 a query template and returns results as a list of Information System elements. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the specified query template with no parameters
- Returns query results as a typed list of Information System elements
- Uses default parameter values if the template defines any parameters
- Results are filtered based on user authorization and context access
- Automatically deserializes JSON results to specified type.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution or parameter values
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Query execution respects context boundaries based on user authorization.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute a query template and get typed results List<EService> services = client.run("GetAllEService");- Type Parameters:
E- The specific type of Information System element expected in results- Parameters:
name- The name of the query template to execute- Returns:
- List of Information System elements from query execution
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
run
<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 a query template using template object and returns results as a list of Information System elements. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the query template with no parameters
- The template name is extracted from the provided
QueryTemplateobject - Returns query results as a typed list of Information System elements
- Uses default parameter values if the template defines any parameters
- Results are filtered based on user authorization and context access
- Automatically deserializes JSON results to specified type.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution or parameter values
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Query execution respects context boundaries based on user authorization.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute a query template using template object QueryTemplate template = new QueryTemplate(); template.setName("GetAllEService"); List<EService> services = client.run(template);- Type Parameters:
E- The specific type of Information System element expected in results- Parameters:
queryTemplate- The query template to execute (name is extracted from this object)- Returns:
- List of Information System elements from query execution
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
run
String run(String name, String params) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Executes a query template with string parameters and returns results as JSON string. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the specified query template with provided parameter values
- Parameters are provided as a JSON string containing parameter substitutions
- Returns query results as a JSON array string
- Template variables are replaced with provided parameter values
- Results are filtered based on user authorization and context access.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution, parameter values, or parameter format
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Query execution respects context boundaries based on user authorization.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute with string parameters String params = "{\"state\":\"ready\",\"namePattern\":\"%Service%\"}"; String resultsJson = client.run("GetAllEServiceWithState", params);- Parameters:
name- The name of the query template to executeparams- JSON string containing parameter values for template substitution- Returns:
- JSON array string containing query results
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
run
<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 a query template with JsonNode parameters and returns results as a list of Information System elements. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the specified query template with provided parameter values
- Parameters are provided as a JsonNode object containing parameter substitutions
- Returns query results as a typed list of Information System elements
- Template variables are replaced with provided parameter values
- Results are filtered based on user authorization and context access
- Automatically deserializes JSON results to specified type.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution, parameter values, or parameter format
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- Query execution respects context boundaries based on user authorization.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute with JsonNode parameters ObjectMapper mapper = new ObjectMapper(); JsonNode params = mapper.createObjectNode() .put("state", "ready") .put("namePattern", "%Service%"); List<EService> services = client.run("GetAllEServiceWithState", params);- Type Parameters:
E- The specific type of Information System element expected in results- Parameters:
name- The name of the query template to executejsonNode- JsonNode containing parameter values for template substitution- Returns:
- List of Information System elements from query execution
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
run
<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 a query template using template object with JsonNode parameters and returns results as a list of Information System elements. Corresponding REST API:POST /query-templates/{query-template-name}[?polymorphic={true|false}&includeMeta={true|false}&allMeta={true|false}&includeContexts={true|false}&hierarchical={true|false}]Operation Behavior:- Executes the query template with provided parameter values
- The template name is extracted from the provided
QueryTemplateobject - Parameters are provided as a JsonNode object containing parameter substitutions
- Returns query results as a typed list of Information System elements
- Template variables are replaced with provided parameter values
- Results are filtered based on user authorization and context access
- Automatically deserializes JSON results to specified type.
- 200 OK: Query template successfully executed
- 404 Not Found: Query template with the specified name does not exist
- 400 Bad Request: Invalid query execution, parameter values, or parameter format
- 403 Forbidden: Insufficient permissions to execute the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Parameter values from JsonNode are used for template variable substitution
- All template parameters must be provided in the JsonNode or have default values.
- Query execution respects context boundaries based on user authorization
- Hierarchical mode can be enabled for administrative users to query across context hierarchies.
- IS-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- Infrastructure-Manager: Full access to execute any query template with hierarchical querying across all contexts; receives complete, unfiltered metadata
- All Other Users: Basic access with metadata filtering; receive metadata with sensitive information filtered when includeMeta=true.
- Query execution respects context boundaries based on user authorization.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Execute using template object with JsonNode parameters QueryTemplate template = new QueryTemplate(); template.setName("GetAllEServiceWithState"); ObjectMapper mapper = new ObjectMapper(); JsonNode params = mapper.createObjectNode() .put("state", "ready") .put("namePattern", "%Service%"); List<EService> services = client.run(template, params);- Type Parameters:
E- The specific type of Information System element expected in results- Parameters:
queryTemplate- The query template to execute (name is extracted from this object)jsonNode- JsonNode containing parameter values for template substitution- Returns:
- List of Information System elements from query execution
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException- If the query template with the specified name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template execution
-
delete
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.ResourceRegistryException Deletes an existing query template from the Resource Registry. Corresponding REST API:DELETE /query-templates/{query-template-name}Operation Behavior:- Permanently deletes the specified query template using its name
- The template name is automatically extracted from the provided
QueryTemplateobject - This operation is irreversible and cannot be undone
- Once deleted, the template name becomes available for reuse
- The operation is atomic - either the template is completely deleted or the operation fails.
- 204 No Content: Query template successfully deleted
- 404 Not Found: Query template with the specified name does not exist
- 403 Forbidden: Insufficient permissions to delete the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- This endpoint does not accept any query parameters
- No filtering or metadata options are available for delete operations.
- The query template name is automatically extracted from the provided
QueryTemplateobject - Only the name field is used for template deletion.
- Query templates are global resources accessible across contexts
- Deletion permissions depend on user role and authorization.
- IS-Manager: Full access to delete any query template
- Infrastructure-Manager: Full access to delete any query template
- All Other Users: Basic access to delete query templates; same deletion permissions as administrative users.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Delete a query template using template object QueryTemplate template = new QueryTemplate(); template.setName("GetAllEServiceWithState"); boolean deleted = client.delete(template);- Parameters:
queryTemplate- The query template to delete (must have a valid name)- 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
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. Corresponding REST API:DELETE /query-templates/{query-template-name}Operation Behavior:- Permanently deletes the specified query template using its name
- This operation is irreversible and cannot be undone
- Once deleted, the template name becomes available for reuse
- The operation is atomic - either the template is completely deleted or the operation fails
- Most direct method when template name is already known.
- 204 No Content: Query template successfully deleted
- 404 Not Found: Query template with the specified name does not exist
- 403 Forbidden: Insufficient permissions to delete the query template
- 401 Unauthorized: Invalid or missing authentication credentials.
- This endpoint does not accept any query parameters
- No filtering or metadata options are available for delete operations.
- The specified name must be a valid query template name
- Template names are case-sensitive and must match exactly
- Name must correspond to an existing template.
- Query templates are global resources accessible across contexts
- Deletion permissions depend on user role and authorization.
- IS-Manager: Full access to delete any query template
- Infrastructure-Manager: Full access to delete any query template
- All Other Users: Basic access to delete query templates; same deletion permissions as administrative users.
ResourceRegistryQueryTemplateClient client = ResourceRegistryQueryTemplateClientFactory.create(); // Delete a query template by name boolean deleted = client.delete("GetAllEServiceWithState");- Parameters:
queryTemplateName- The name of the query template to delete- 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
-