diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java index a62711f..1dd8e21 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java @@ -338,5 +338,52 @@ public class EntityManager { facetManagement.setUUID(UUID.fromString(uuid)); return facetManagement.addToContext(); } + + /** + * e.g POST + * /resource-registry/remove/resource/67062c11-9c3a-4906-870d-7df6a43408b0 + * + * @param uuid + * @return + * @throws ResourceNotFoundException + * @throws ContextNotFoundException + * @throws ResourceRegistryException + */ + @POST + @Path(EntityPath.REMOVE_PATH_PART + "/" + EntityPath.RESOURCE_PATH_PART + "/{" + + ID_PATH_PARAM + "}") + public boolean removeResourceFromContext(@PathParam(ID_PATH_PARAM) String uuid) + throws ResourceNotFoundException, ContextNotFoundException, + ResourceRegistryException { + logger.info("requested to remove {} with UUID {} from current context {}", + Resource.NAME, uuid, ContextUtility.getCurrentContext()); + ResourceManagement resourceManagement = new ResourceManagement(); + resourceManagement.setUUID(UUID.fromString(uuid)); + return resourceManagement.removeFromContext(); + } + + /** + * e.g POST + * /resource-registry/remove/facet/f6931232-c034-4979-9b2f-7193d3fba7df + * + * @param uuid + * @return + * @throws FacetNotFoundException + * @throws ContextNotFoundException + * @throws ResourceRegistryException + */ + @POST + @Path(EntityPath.REMOVE_PATH_PART + "/" + EntityPath.FACET_PATH_PART + "/{" + + ID_PATH_PARAM + "}") + public boolean removeFacetFromContext(@PathParam(ID_PATH_PARAM) String uuid) + throws FacetNotFoundException, ContextNotFoundException, + ResourceRegistryException { + logger.info("requested to remove {} with UUID {} from current context {}", + Facet.NAME, uuid, ContextUtility.getCurrentContext()); + FacetManagement facetManagement = new FacetManagement(); + facetManagement.setUUID(UUID.fromString(uuid)); + return facetManagement.removeFromContext(); + } + }