Class InstancesManager
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
org.gcube.informationsystem.resourceregistry.rest.core.InstancesManager
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseaddToContext(String type, String instanceId, String newContextId) Adds an existing instance to a target Context and returns the affected-instance envelope.jakarta.ws.rs.core.ResponseCreates a new instance, non-idempotently.jakarta.ws.rs.core.ResponseRemoves an instance from the current Context and returns the affected-instance envelope.getInstanceContexts(String type, String instanceId) Returns the token-subtree-filtered Context membership map for an exact instance.mergeUpdate(String type, String instanceId, String json) Applies an RFC 7396 merge update and returns the read-shaped target instance.jakarta.ws.rs.core.ResponseExecutes a role-filtered, paginated JSON Query-By-Example over Instances.Reads one visible instance using its exact concrete Type and UUID.jakarta.ws.rs.core.ResponseReturns a role-filtered, paginated list for a concrete or abstract instance Type.jakarta.ws.rs.core.ResponseupdateOrCreate(String type, String instanceId, String json) Creates or fully replaces the exact instance addressed by the path.Methods inherited from class org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
buildResponse, buildResponse, setAccountingMethod, setAccountingMethod
-
Field Details
-
INSTANCE_UUID_PATH_PARAMETER
Path parameter name for instance UUIDs.- See Also:
-
INSTANCE
Metric accounting type label.- See Also:
-
GET_INSTANCE_CONTEXTS_METHOD
Name of the list-instance-contexts operation.- See Also:
-
-
Constructor Details
-
InstancesManager
public InstancesManager()Creates a newInstancesManagerREST resource.
-
-
Method Details
-
readAll
@GET @Path("/{type-name}") @Produces("application/json") public jakarta.ws.rs.core.Response readAll(@PathParam("type-name") String type) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Returns a role-filtered, paginated list for a concrete or abstract instance Type.- Parameters:
type- the case-sensitive name of a Resource, Facet, IsRelatedTo, or ConsistsOf Type- Returns:
- a JAX-RS response containing the JSON array of instances
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the type is not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
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 role-filtered, paginated JSON Query-By-Example over Instances.- Parameters:
jsonQuery- the JSON query specification- Returns:
- a JAX-RS response containing the JSON array of matching instances
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the query syntax or structure is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
read
@GET @Path("/{type-name}/{instance-uuid}") @Produces("application/json") public String read(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Reads one visible instance using its exact concrete Type and UUID.- Parameters:
type- the exact concrete Information System Type of the instanceinstanceId- the UUID of the instance to retrieve- Returns:
- the JSON representation of the retrieved instance
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the type or instance is not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
create
@POST @Path("/{type-name}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response create(@PathParam("type-name") String type, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new instance, non-idempotently.- Parameters:
type- the exact concrete Entity or Relation type name of the instance to createjson- the complete JSON representation of the new instance- Returns:
- a JAX-RS response with the created instance in the body
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
updateOrCreate
@PUT @Path("/{type-name}/{instance-uuid}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response updateOrCreate(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates or fully replaces the exact instance addressed by the path.- Parameters:
type- the exact concrete Entity or Relation type name of the target instanceinstanceId- the UUID of the instance to create or updatejson- the complete JSON representation of the instance- Returns:
- a JAX-RS response indicating success, with the updated/created instance in the body
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
mergeUpdate
@PATCH @Path("/{type-name}/{instance-uuid}") @Consumes("application/merge-patch+json") @Produces("application/json") public String mergeUpdate(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Applies an RFC 7396 merge update and returns the read-shaped target instance.- Parameters:
type- the exact concrete Entity or Relation type name of the target instanceinstanceId- the UUID of the instance to updatejson- the JSON merge patch payload- Returns:
- the JSON representation of the merged instance
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
delete
@DELETE @Path("/{type-name}/{instance-uuid}") @Produces("application/json") public jakarta.ws.rs.core.Response delete(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Removes an instance from the current Context and returns the affected-instance envelope.- Parameters:
type- the exact concrete Entity or Relation type name of the instanceinstanceId- the UUID of the instance to remove- Returns:
- a JAX-RS response containing the affected-instance envelope
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
addToContext
@PUT @Path("{type-name}/{instance-uuid}/contexts/{context-uuid}") @Produces("application/json") public jakarta.ws.rs.core.Response addToContext(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId, @PathParam("context-uuid") String newContextId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Adds an existing instance to a target Context and returns the affected-instance envelope.- Parameters:
type- the exact concrete Entity or Relation type name of the target instanceinstanceId- the UUID of the instance to add to the target ContextnewContextId- the UUID of the target Context- Returns:
- a JAX-RS response containing the affected-instance envelope
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
getInstanceContexts
@GET @Path("{type-name}/{instance-uuid}/contexts") @Produces("application/json") public String getInstanceContexts(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Returns the token-subtree-filtered Context membership map for an exact instance.- Parameters:
type- the exact concrete Entity or Relation type name of the instanceinstanceId- the UUID of the instance whose Context memberships are requested- Returns:
- JSON object mapping Context UUIDs to current paths
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-