refs #5753: Expose Remove From Context API

https://support.d4science.org/issues/5753

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141291 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-12-20 17:34:06 +00:00
parent 30dc36d5bc
commit 19206b90b7
1 changed files with 47 additions and 0 deletions

View File

@ -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();
}
}