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:
parent
2d8bc920ca
commit
1140ac31ad
|
@ -5,6 +5,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.model.ER;
|
import org.gcube.informationsystem.model.ER;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
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.model.relation.Relation;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
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.ERException;
|
||||||
|
@ -23,11 +24,11 @@ public interface ResourceRegistryClient {
|
||||||
Class<ERType> clazz, UUID uuid) throws ERNotFoundException,
|
Class<ERType> clazz, UUID uuid) throws ERNotFoundException,
|
||||||
ResourceRegistryException;
|
ResourceRegistryException;
|
||||||
|
|
||||||
public <ERType extends ER> List<ERType> getInstances(
|
public <ERType extends ER> List<? extends Entity> getInstances(
|
||||||
Class<ERType> clazz, Boolean polymorphic) throws
|
Class<ERType> clazz, Boolean polymorphic) throws
|
||||||
ERException, SchemaException, ResourceRegistryException;
|
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,
|
Class<R> clazz, Boolean polymorphic,
|
||||||
UUID reference, Direction direction) throws
|
UUID reference, Direction direction) throws
|
||||||
ERException, SchemaException, ResourceRegistryException;
|
ERException, SchemaException, ResourceRegistryException;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.informationsystem.impl.utils.Entities;
|
import org.gcube.informationsystem.impl.utils.Entities;
|
||||||
import org.gcube.informationsystem.model.ER;
|
import org.gcube.informationsystem.model.ER;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
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.model.relation.Relation;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
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.ERException;
|
||||||
|
@ -301,7 +302,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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,
|
Boolean polymorphic) throws ERNotFoundException,
|
||||||
ResourceRegistryException {
|
ResourceRegistryException {
|
||||||
String type = clazz.getSimpleName();
|
String type = clazz.getSimpleName();
|
||||||
|
@ -328,7 +329,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
String ret = delegate.make(call);
|
String ret = delegate.make(call);
|
||||||
logger.info("Got instances of {} are {}", type, ret);
|
logger.info("Got instances of {} are {}", type, ret);
|
||||||
|
|
||||||
return Entities.unmarshalList(clazz, ret);
|
return Entities.unmarshalList(Entity.class, ret);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error while getting {} instances", type, e);
|
logger.error("Error while getting {} instances", type, e);
|
||||||
|
@ -337,7 +338,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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,
|
Class<R> clazz, Boolean polymorphic, UUID reference,
|
||||||
Direction direction) throws ERException, SchemaException,
|
Direction direction) throws ERException, SchemaException,
|
||||||
ResourceRegistryException {
|
ResourceRegistryException {
|
||||||
|
@ -371,7 +372,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
logger.info("Got instances of {} from/to {} are {}", type,
|
logger.info("Got instances of {} from/to {} are {}", type,
|
||||||
reference.toString(), ret);
|
reference.toString(), ret);
|
||||||
|
|
||||||
return Entities.unmarshalList(Entity.class, ret);
|
return Entities.unmarshalList(Resource.class, ret);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error while getting instances of {} from/to {}", type, e);
|
logger.error("Error while getting instances of {} from/to {}", type, e);
|
||||||
|
|
Loading…
Reference in New Issue