Exposed get all context through access port type
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@160193 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4e59b78f6b
commit
275d9bf758
|
@ -64,5 +64,7 @@ public interface ResourceRegistryClient {
|
|||
throws SchemaNotFoundException, ResourceRegistryException;
|
||||
|
||||
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public List<Context> getAllContext() throws ResourceRegistryException;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,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;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPCall.HTTPMETHOD;
|
||||
import org.gcube.informationsystem.resourceregistry.api.utils.Utility;
|
||||
|
@ -343,6 +344,36 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Context> getAllContext() throws ContextNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to read all {}s", Context.NAME);
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(AccessPath.ACCESS_PATH_PART);
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(AccessPath.CONTEXT_PATH_PART);
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(ContextPath.ALL_PATH_PART);
|
||||
|
||||
HTTPCall httpCall = getHTTPCall();
|
||||
String ret = httpCall.call(String.class, stringWriter.toString(), HTTPMETHOD.GET);
|
||||
|
||||
logger.debug("Got Contexts are {}", ret);
|
||||
return ISMapper.unmarshalList(Context.class, ret);
|
||||
} catch (ResourceRegistryException e) {
|
||||
// logger.trace("Error while getting {} schema for {}", polymorphic ?
|
||||
// AccessPath.POLYMORPHIC_PARAM + " " : "",
|
||||
// type, e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
// logger.trace("Error while getting {}schema for {}", polymorphic ?
|
||||
// AccessPath.POLYMORPHIC_PARAM + " " : "",
|
||||
// type, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <ISM extends ISManageable> List<TypeDefinition> getSchema(Class<ISM> clazz, Boolean polymorphic)
|
||||
|
|
Loading…
Reference in New Issue