Fixing API

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@141569 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-01-13 16:57:33 +00:00
parent 2d8bc920ca
commit 1140ac31ad
2 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,7 @@ 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;
@ -23,11 +24,11 @@ public interface ResourceRegistryClient {
Class<ERType> clazz, UUID uuid) throws ERNotFoundException,
ResourceRegistryException;
public <ERType extends ER> List<ERType> getInstances(
public <ERType extends ER> List<? extends Entity> getInstances(
Class<ERType> clazz, Boolean polymorphic) throws
ERException, SchemaException, ResourceRegistryException;
public <R extends Relation<Entity, Entity>> List<Entity> getInstancesFromEntity(
public <R extends Relation<Entity, Entity>> List<Resource> getInstancesFromEntity(
Class<R> clazz, Boolean polymorphic,
UUID reference, Direction direction) throws
ERException, SchemaException, ResourceRegistryException;

View File

@ -29,6 +29,7 @@ import org.gcube.common.scope.api.ScopeProvider;
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;
@ -301,7 +302,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
}
@Override
public <ERType extends ER> List<ERType> getInstances(Class<ERType> clazz,
public <ERType extends ER> List<? extends Entity> getInstances(Class<ERType> clazz,
Boolean polymorphic) throws ERNotFoundException,
ResourceRegistryException {
String type = clazz.getSimpleName();
@ -328,7 +329,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
String ret = delegate.make(call);
logger.info("Got instances of {} are {}", type, ret);
return Entities.unmarshalList(clazz, ret);
return Entities.unmarshalList(Entity.class, ret);
} catch (Exception e) {
logger.error("Error while getting {} instances", type, e);
@ -337,7 +338,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
}
@Override
public <R extends Relation<Entity, Entity>> List<Entity> getInstancesFromEntity(
public <R extends Relation<Entity, Entity>> List<Resource> getInstancesFromEntity(
Class<R> clazz, Boolean polymorphic, UUID reference,
Direction direction) throws ERException, SchemaException,
ResourceRegistryException {
@ -371,7 +372,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
logger.info("Got instances of {} from/to {} are {}", type,
reference.toString(), ret);
return Entities.unmarshalList(Entity.class, ret);
return Entities.unmarshalList(Resource.class, ret);
} catch (Exception e) {
logger.error("Error while getting instances of {} from/to {}", type, e);