Fixed REST PATH for API to get all contexts

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@160169 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-12-07 14:22:22 +00:00
parent eabfa329d2
commit ba83014726
1 changed files with 8 additions and 12 deletions

View File

@ -65,11 +65,15 @@ public class ContextManager {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String read(@PathParam(ID_PATH_PARAM) String uuid)
throws ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);
ContextManagement contextManagement = new ContextManagement();
if(uuid.compareTo(ContextPath.ALL_PATH_PART)==0) {
return contextManagement.all(false);
}else {
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);
contextManagement.setUUID(UUID.fromString(uuid));
return contextManagement.read();
}
}
/**
* e.g. POST /resource-registry/context
@ -103,12 +107,4 @@ public class ContextManager {
return contextManagement.delete();
}
@GET
@Path("{" + ContextPath.ALL_PATH_PART + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String all() throws ResourceRegistryException {
logger.info("Requested to get the list of all {}s", Context.NAME);
ContextManagement contextManagement = new ContextManagement();
return contextManagement.all(false);
}
}