Class ContextManager
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
org.gcube.informationsystem.resourceregistry.rest.admin.ContextManager
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant representing the context UUID path parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchangeState(String uuid, String json) Applies a tracked merge patch to the Context identified by the path UUID.jakarta.ws.rs.core.ResponseCreates or idempotently returns the Context identified by the path UUID.jakarta.ws.rs.core.ResponseLogically deletes the Context identified by UUID, moving it to the cemetery.jakarta.ws.rs.core.ResponseReturns the paginated list of visible Contexts for the current caller.jakarta.ws.rs.core.ResponseExecutes a JSON Query-By-Example request for Contexts.jakarta.ws.rs.core.ResponseReturns the Context identified by UUID.jakarta.ws.rs.core.ResponseReturns the Context associated with the caller's token.jakarta.ws.rs.core.ResponseDeprecated.readHistory(String uuid) Returns the reverse-chronological Event history of the Context identified by UUID.Methods inherited from class org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
buildResponse, buildResponse, setAccountingMethod, setAccountingMethod
-
Field Details
-
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.ResourceRegistryExceptionReturns 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 invalidorg.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.ResourceRegistryExceptionReturns 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 Contextorg.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.ResourceRegistryExceptionDeprecated.UseGET /contexts/@currentinstead.Backward-compatible alias forGET /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 Contextorg.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 existsorg.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 createjson- 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 updatejson- 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 existsorg.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
-
GET /contexts/@currentinstead.