Exposed get all context through access port type

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

View File

@ -29,6 +29,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFound
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.ContextPath;
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPCall.HTTPMETHOD;
import org.gcube.informationsystem.resourceregistry.context.ContextManagement;
import org.gcube.informationsystem.resourceregistry.er.ERManagement;
@ -273,10 +274,15 @@ public class Access {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String getContext(@PathParam(ID_PATH_PARAM) String uuid)
throws ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.model.entity.Context.NAME, uuid);
ContextManagement contextManagement = new ContextManagement();
contextManagement.setUUID(UUID.fromString(uuid));
return contextManagement.read();
if(uuid.compareTo(ContextPath.ALL_PATH_PART)==0) {
logger.info("Requested to read all {}s", org.gcube.informationsystem.model.entity.Context.NAME);
return contextManagement.all(false);
}else {
logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.model.entity.Context.NAME, uuid);
contextManagement.setUUID(UUID.fromString(uuid));
return contextManagement.read();
}
}
}

View File

@ -67,6 +67,7 @@ public class ContextManager {
throws ContextNotFoundException, ResourceRegistryException {
ContextManagement contextManagement = new ContextManagement();
if(uuid.compareTo(ContextPath.ALL_PATH_PART)==0) {
logger.info("Requested to read all {}s", Context.NAME);
return contextManagement.all(false);
}else {
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);