diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClient.java index 023759d..3cccf6e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClient.java @@ -6,7 +6,6 @@ import java.util.UUID; import org.gcube.informationsystem.model.ER; import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Resource; -import org.gcube.informationsystem.model.relation.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException; @@ -24,12 +23,12 @@ public interface ResourceRegistryClient { Class clazz, UUID uuid) throws ERNotFoundException, ResourceRegistryException; - public List getInstances( - Class clazz, Boolean polymorphic) throws + public List getInstances( + String type, Boolean polymorphic) throws ERException, SchemaException, ResourceRegistryException; - public > List getInstancesFromEntity( - Class clazz, Boolean polymorphic, + public List getInstancesFromEntity( + String relationType, Boolean polymorphic, UUID reference, Direction direction) throws ERException, SchemaException, ResourceRegistryException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClientImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClientImpl.java index 130b0ad..bb3a3e5 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClientImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/proxy/ResourceRegistryClientImpl.java @@ -30,7 +30,6 @@ import org.gcube.informationsystem.impl.utils.Entities; import org.gcube.informationsystem.model.ER; import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Resource; -import org.gcube.informationsystem.model.relation.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException; @@ -302,17 +301,16 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient { } @Override - public List getInstances(Class clazz, + public List getInstances(String type, Boolean polymorphic) throws ERNotFoundException, ResourceRegistryException { - String type = clazz.getSimpleName(); try { logger.info("Going to get all instances of {} ", type); StringWriter stringWriter = new StringWriter(); stringWriter.append(PATH_SEPARATOR); stringWriter.append(AccessPath.ACCESS_PATH_PART); stringWriter.append(PATH_SEPARATOR); - stringWriter.append(AccessPath.INSTANCE_PATH_PART); + stringWriter.append(AccessPath.INSTANCES_PATH_PART); stringWriter.append(PATH_SEPARATOR); stringWriter.append(type); @@ -338,21 +336,20 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient { } @Override - public > List getInstancesFromEntity( - Class clazz, Boolean polymorphic, UUID reference, + public List getInstancesFromEntity( + String relationType, Boolean polymorphic, UUID reference, Direction direction) throws ERException, SchemaException, ResourceRegistryException { - String type = clazz.getSimpleName(); try { - logger.info("Going to get all instances of {} from/to {}", type, + logger.info("Going to get all instances of {} from/to {}", relationType, reference.toString()); StringWriter stringWriter = new StringWriter(); stringWriter.append(PATH_SEPARATOR); stringWriter.append(AccessPath.ACCESS_PATH_PART); stringWriter.append(PATH_SEPARATOR); - stringWriter.append(AccessPath.INSTANCE_PATH_PART); + stringWriter.append(AccessPath.INSTANCES_PATH_PART); stringWriter.append(PATH_SEPARATOR); - stringWriter.append(type); + stringWriter.append(relationType); List> parameters = new ArrayList<>(); parameters.add(new RREntry( @@ -369,13 +366,13 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient { String.class, httpInputs); String ret = delegate.make(call); - logger.info("Got instances of {} from/to {} are {}", type, + logger.info("Got instances of {} from/to {} are {}", relationType, reference.toString(), ret); return Entities.unmarshalList(Resource.class, ret); } catch (Exception e) { - logger.error("Error while getting instances of {} from/to {}", type, e); + logger.error("Error while getting instances of {} from/to {}", relationType, e); throw new ResourceRegistryException(e); } }