diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index 256f93f..2048a1e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -23,12 +23,16 @@ import org.gcube.informationsystem.model.entity.Facet; import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.resourceregistry.ResourceInitializer; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; +import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; +import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPCall.HTTPMETHOD; +import org.gcube.informationsystem.resourceregistry.context.ContextManagement; +import org.gcube.informationsystem.resourceregistry.context.ContextManagementImpl; import org.gcube.informationsystem.resourceregistry.er.ERManagement; import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement; import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; @@ -280,9 +284,22 @@ public class Access { @QueryParam(AccessPath.POLYMORPHIC_PARAM) @DefaultValue("false") Boolean polymorphic) throws SchemaNotFoundException, ResourceRegistryException { logger.info("Requested Schema for type {}", type); - SchemaManagement schemaManagement = new SchemaManagementImpl(); return schemaManagement.read(type, polymorphic); } + + /* + * e.g. GET /resource-registry/access/context/c0f314e7-2807-4241-a792-2a6c79ed4fd0 + */ + @GET + @Path(AccessPath.CONTEXT_PATH_PART + "{" + ID_PATH_PARAM + "}") + @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) + public String read(@PathParam(ID_PATH_PARAM) String uuid) + throws ContextNotFoundException, ContextException { + logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.model.entity.Context.NAME, uuid); + ContextManagement contextManager = new ContextManagementImpl(); + return contextManager.read(UUID.fromString(uuid)); + } + } \ No newline at end of file