Aligned APIs with the rr-publisher APIs

This commit is contained in:
Luca Frosini 2021-09-14 16:34:20 +02:00
parent ac1f23c36e
commit f9a2a599d9
2 changed files with 11 additions and 11 deletions

View File

@ -6,8 +6,8 @@ import java.util.Set;
import java.util.UUID;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
@ -25,18 +25,18 @@ import org.gcube.informationsystem.types.reference.Type;
*/
public interface ResourceRegistryClient {
public <IE extends IdentifiableElement, R extends Resource> List<R> getInstances(Class<IE> clazz, Boolean polymorphic)
public <ERElem extends ERElement> List<ERElem> getInstances(Class<ERElem> clazz, Boolean polymorphic)
throws ResourceRegistryException;
public String getInstances(String type, Boolean polymorphic) throws ResourceRegistryException;
public <IE extends IdentifiableElement> boolean exists(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> boolean exists(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
public boolean exists(String type, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
public <IE extends IdentifiableElement> IE getInstance(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> ERElem getInstance(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
public String getInstance(String type, UUID uuid)
@ -118,7 +118,7 @@ public interface ResourceRegistryClient {
public List<Context> getAllContext() throws ResourceRegistryException;
public <IE extends IdentifiableElement> Set<UUID> getInstanceContexts(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> Set<UUID> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
public Set<UUID> getInstanceContexts(String type, UUID uuid)

View File

@ -11,8 +11,8 @@ import java.util.UUID;
import org.gcube.common.gxhttp.reference.GXConnection;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
@ -218,12 +218,12 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
@SuppressWarnings("unchecked")
@Override
public <IE extends IdentifiableElement, R extends Resource> List<R> getInstances(Class<IE> clazz, Boolean polymorphic)
public <ERElem extends ERElement> List<ERElem> getInstances(Class<ERElem> clazz, Boolean polymorphic)
throws ResourceRegistryException {
String type = Utility.getTypeName(clazz);
String ret = getInstances(type, polymorphic);
try {
return (List<R>) ElementMapper.unmarshalList(Resource.class, ret);
return (List<ERElem>) ElementMapper.unmarshalList(ERElement.class, ret);
} catch(Exception e) {
throw new RuntimeException(e);
}
@ -260,7 +260,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
}
@Override
public <IE extends IdentifiableElement> boolean exists(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> boolean exists(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
String type = Utility.getTypeName(clazz);
return exists(type, uuid);
@ -298,7 +298,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
}
@Override
public <IE extends IdentifiableElement> IE getInstance(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> ERElem getInstance(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
String type = Utility.getTypeName(clazz);
String ret = getInstance(type, uuid);
@ -609,7 +609,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
}
@Override
public <IE extends IdentifiableElement> Set<UUID> getInstanceContexts(Class<IE> clazz, UUID uuid)
public <ERElem extends ERElement> Set<UUID> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
String typeName = Utility.getTypeName(clazz);
return getInstanceContexts(typeName, uuid);