Class QueryTemplateManager

java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
org.gcube.informationsystem.resourceregistry.rest.core.QueryTemplateManager

@Path("query-templates") public class QueryTemplateManager extends BaseRest
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • QUERY_TEMPLATE_NAME_PATH_PARAMETER

      public static final String QUERY_TEMPLATE_NAME_PATH_PARAMETER
      The path parameter name for identifying a query template by name.
      See Also:
  • Constructor Details

  • Method Details

    • all

      @GET @Produces("application/json") public jakarta.ws.rs.core.Response all() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated list of Query Templates for the current caller.
      Returns:
      JAX-RS response containing the JSON array of Query Template definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • updateCreate

      @PUT @Path("{name}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response updateCreate(@PathParam("name") String queryTemplateName, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates or fully replaces the Query Template identified by its name.
      Parameters:
      queryTemplateName - The name of the query template to create or update (must match the "name" field in the JSON body)
      json - JSON representation of the query template to create or update
      Returns:
      JSON object containing the created or updated query template with its properties and metadata (if requested)
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - If the query template definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during query template creation or update
    • read

      @GET @Path("{name}") @Produces("application/json") public String read(@PathParam("name") String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves a specific query template by its name from the Resource Registry.
      Parameters:
      queryTemplateName - The name of the query template to retrieve
      Returns:
      JSON object containing the requested query template with its properties and metadata (if requested)
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - If the query template with the specified name does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during query template retrieval
    • run

      @Path("{name}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response run(@PathParam("name") String queryTemplateName, String params) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated result of executing the query template with the specified name and parameters.
      Parameters:
      queryTemplateName - the name of the query template to execute
      params - JSON object containing parameter values for template substitution
      Returns:
      JAX-RS response containing the JSON array of query results
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the query template with the specified name does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query execution fails due to invalid parameters or query structure
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if an error occurs during query template execution
    • delete

      @DELETE @Path("{name}") public jakarta.ws.rs.core.Response delete(@PathParam("name") String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Deletes a query template with the specified name from the Resource Registry.
      Parameters:
      queryTemplateName - the exact name of the query template to delete
      Returns:
      HTTP 204 No Content response upon successful deletion
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the query template with the specified name does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if an error occurs during query template deletion
    • query

      @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response query(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated result of executing a JSON query against the Query Template collection.
      Parameters:
      jsonQuery - JSON object describing the Query Template structure to search for
      Returns:
      JAX-RS response containing the JSON array of matching Query Template definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query syntax is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails