java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
org.gcube.informationsystem.resourceregistry.rest.admin.ContextManager

@Path("contexts") public class ContextManager extends BaseRest
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • CONTEXT_UUID_PATH_PARAMETER

      public static final String CONTEXT_UUID_PATH_PARAMETER
      Constant representing the context UUID path parameter.
      See Also:
  • Constructor Details

    • ContextManager

      public ContextManager()
      Default constructor for ContextManager.
  • Method Details

    • listContexts

      @GET @Produces("application/json") public jakarta.ws.rs.core.Response listContexts() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated list of visible Contexts for the current caller.
      Returns:
      JAX-RS response containing the paginated JSON array of Contexts
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • 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
      Executes a JSON Query-By-Example request for Contexts.
      Parameters:
      jsonQuery - JSON object describing the Context Query-By-Example structure to search for
      Returns:
      JAX-RS response containing the paginated JSON array of matching Contexts
      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
    • readCurrentContext

      @GET @Path("@current") @Produces("application/json") public jakarta.ws.rs.core.Response readCurrentContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the Context associated with the caller's token.
      Returns:
      JAX-RS response containing the JSON representation of the current Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if the caller's token resolves to no live or cemetery Context
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readCurrentContextLegacy

      @GET @Path("CURRENT_CONTEXT") @Produces("application/json") @Deprecated public jakarta.ws.rs.core.Response readCurrentContextLegacy() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Deprecated.
      Use GET /contexts/@current instead.
      Backward-compatible alias for GET /contexts/@current.
      Returns:
      JAX-RS response containing the JSON representation of the current Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if the caller's token resolves to no live or cemetery Context
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • read

      @GET @Path("{context-uuid}") @Produces("application/json") public jakarta.ws.rs.core.Response read(@PathParam("context-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the Context identified by UUID.
      Parameters:
      uuid - the UUID of the Context to retrieve
      Returns:
      JAX-RS response containing the JSON representation of the Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if no Context with the specified UUID exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • create

      @PUT @Path("{context-uuid}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response create(@PathParam("context-uuid") String uuid, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates or idempotently returns the Context identified by the path UUID.
      Parameters:
      uuid - the UUID of the Context to create
      json - the JSON representation of the Context to create
      Returns:
      JAX-RS response containing the JSON representation of the created (or already-existing, idempotent) Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database write fails
    • changeState

      @PATCH @Path("{context-uuid}") @Consumes("application/merge-patch+json") @Produces("application/json") public String changeState(@PathParam("context-uuid") String uuid, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Applies a tracked merge patch to the Context identified by the path UUID.
      Parameters:
      uuid - the UUID of the Context to update
      json - the JSON merge-patch document to apply
      Returns:
      the JSON representation of the updated Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database write fails
    • delete

      @DELETE @Path("{context-uuid}") public jakarta.ws.rs.core.Response delete(@PathParam("context-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Logically deletes the Context identified by UUID, moving it to the cemetery.
      Parameters:
      uuid - the UUID of the Context to delete
      Returns:
      JAX-RS response confirming the deletion
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if no live Context with the specified UUID exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database write fails
    • readHistory

      @GET @Path("{context-uuid}/history") @Produces("application/json") public String readHistory(@PathParam("context-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the reverse-chronological Event history of the Context identified by UUID.
      Parameters:
      uuid - the UUID of the Context whose history to read
      Returns:
      the JSON array of Event objects, newest first
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails