Refs #11902: Use new REST interface in Resource Registry Client

Task-Url: https://support.d4science.org/issues/11902

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@169061 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-06-12 14:06:48 +00:00
parent 296d22363e
commit 9056e3ec82
2 changed files with 13 additions and 15 deletions

View File

@ -7,12 +7,10 @@ import java.util.UUID;
import org.gcube.informationsystem.model.ER; import org.gcube.informationsystem.model.ER;
import org.gcube.informationsystem.model.ISManageable; import org.gcube.informationsystem.model.ISManageable;
import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet; import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource; import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.model.relation.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -84,11 +82,11 @@ public interface ResourceRegistryClient {
public String getRelatedResources(String resourceType, String isRelatedToType, String referenceResourceType, public String getRelatedResources(String resourceType, String isRelatedToType, String referenceResourceType,
Direction direction, boolean polymorphic) throws ResourceRegistryException; Direction direction, boolean polymorphic) throws ResourceRegistryException;
/*
public <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass, public <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass,
Class<R> relationClass, Class<RE> referenceEntityClass, Direction direction, boolean polymorphic, Class<R> relationClass, Class<RE> referenceEntityClass, Direction direction, boolean polymorphic,
Map<String,Object> map) throws ResourceRegistryException; Map<String,Object> map) throws ResourceRegistryException;
public String getRelated(String entityType, String relationType, String referenceEntityType, Direction direction, public String getRelated(String entityType, String relationType, String referenceEntityType, Direction direction,
boolean polymorphic, Map<String,Object> map) throws ResourceRegistryException; boolean polymorphic, Map<String,Object> map) throws ResourceRegistryException;
@ -102,7 +100,7 @@ public interface ResourceRegistryClient {
public String getRelated(String entityType, String relationType, String referenceEntityType, UUID referenceEntity, public String getRelated(String entityType, String relationType, String referenceEntityType, UUID referenceEntity,
Direction direction, boolean polymorphic) throws ResourceRegistryException; Direction direction, boolean polymorphic) throws ResourceRegistryException;
*/
public String query(final String query, final int limit, final String fetchPlan) public String query(final String query, final int limit, final String fetchPlan)

View File

@ -351,7 +351,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
stringWriter.append(PATH_SEPARATOR); stringWriter.append(PATH_SEPARATOR);
stringWriter.append(referenceEntityType); stringWriter.append(referenceEntityType);
Map<String,Object> parameters = new HashMap<>(map); Map<String,Object> parameters = new HashMap<>();
parameters.put(AccessPath.DIRECTION_PARAM, direction); parameters.put(AccessPath.DIRECTION_PARAM, direction);
parameters.put(AccessPath.POLYMORPHIC_PARAM, polymorphic); parameters.put(AccessPath.POLYMORPHIC_PARAM, polymorphic);
@ -501,8 +501,8 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override // @Override
public <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass, protected <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass,
Class<R> relationClass, Class<RE> referenceEntityClass, Direction direction, boolean polymorphic, Class<R> relationClass, Class<RE> referenceEntityClass, Direction direction, boolean polymorphic,
Map<String,Object> map) throws ResourceRegistryException { Map<String,Object> map) throws ResourceRegistryException {
String entityType = Utility.getType(entityClass); String entityType = Utility.getType(entityClass);
@ -516,14 +516,14 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
} }
} }
@Override // @Override
public String getRelated(String entityType, String relationType, String referenceEntityType, Direction direction, protected String getRelated(String entityType, String relationType, String referenceEntityType, Direction direction,
boolean polymorphic, Map<String,Object> map) throws ResourceRegistryException { boolean polymorphic, Map<String,Object> map) throws ResourceRegistryException {
return getRelated(entityType, relationType, referenceEntityType, null, direction, polymorphic, map); return getRelated(entityType, relationType, referenceEntityType, null, direction, polymorphic, map);
} }
@Override // @Override
public <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass, protected <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass,
Class<R> relationClass, Class<RE> referenceEntityClass, RE referenceEntity, Direction direction, Class<R> relationClass, Class<RE> referenceEntityClass, RE referenceEntity, Direction direction,
boolean polymorphic) throws ResourceRegistryException { boolean polymorphic) throws ResourceRegistryException {
UUID referenceEntityUUID = referenceEntity.getHeader().getUUID(); UUID referenceEntityUUID = referenceEntity.getHeader().getUUID();
@ -532,8 +532,8 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override // @Override
public <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass, protected <E extends Entity, R extends Relation<?,?>, RE extends Entity> List<E> getRelated(Class<E> entityClass,
Class<R> relationClass, Class<RE> referenceEntityClass, UUID referenceEntityUUID, Direction direction, Class<R> relationClass, Class<RE> referenceEntityClass, UUID referenceEntityUUID, Direction direction,
boolean polymorphic) throws ResourceRegistryException { boolean polymorphic) throws ResourceRegistryException {
String entityType = Utility.getType(entityClass); String entityType = Utility.getType(entityClass);
@ -548,8 +548,8 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
} }
} }
@Override // @Override
public String getRelated(String entityType, String relationType, String referenceEntityType, UUID referenceEntity, protected String getRelated(String entityType, String relationType, String referenceEntityType, UUID referenceEntity,
Direction direction, boolean polymorphic) throws ResourceRegistryException { Direction direction, boolean polymorphic) throws ResourceRegistryException {
return getRelated(entityType, relationType, referenceEntityType, referenceEntity, direction, polymorphic, null); return getRelated(entityType, relationType, referenceEntityType, referenceEntity, direction, polymorphic, null);
} }