Refs #10238: Refactor Context Port Type
Task-Url: https://support.d4science.org/issues/10238 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158597 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b9a5ebe072
commit
bcf1621866
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.context;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
import org.gcube.informationsystem.model.AccessType;
|
||||
import org.gcube.informationsystem.model.relation.IsParentOf;
|
||||
|
@ -93,4 +95,18 @@ public class IsParentOfManagement extends RelationManagement<IsParentOf, Context
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContextManagement getSourceEntityManagement(UUID sourceUUID) throws ResourceRegistryException {
|
||||
ContextManagement contextManagement = new ContextManagement(orientGraph);
|
||||
contextManagement.setUUID(sourceUUID);
|
||||
return contextManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContextManagement getTargetEntityManagement(UUID targetUUID) throws ResourceRegistryException {
|
||||
ContextManagement contextManagement = new ContextManagement(orientGraph);
|
||||
contextManagement.setUUID(targetUUID);
|
||||
return contextManagement;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,11 +25,6 @@ import org.gcube.informationsystem.model.ISManageable;
|
|||
import org.gcube.informationsystem.model.embedded.Header;
|
||||
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.Resource;
|
||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.relation.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAlreadyPresentException;
|
||||
|
@ -41,12 +36,6 @@ import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
|||
import org.gcube.informationsystem.resourceregistry.context.IsParentOfManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseIntializator;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.ConsistsOfManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.IsRelatedToManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.HeaderOrient;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility;
|
||||
|
@ -117,95 +106,6 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
|||
this.forceAdmin = forceAdmin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(AccessType querableType)
|
||||
throws ResourceRegistryException {
|
||||
switch (querableType) {
|
||||
case FACET:
|
||||
return new FacetManagement();
|
||||
|
||||
case RESOURCE:
|
||||
return new ResourceManagement();
|
||||
|
||||
case IS_RELATED_TO:
|
||||
return new IsRelatedToManagement();
|
||||
|
||||
case CONSISTS_OF:
|
||||
return new ConsistsOfManagement();
|
||||
|
||||
default:
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not querable", querableType.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(String type)
|
||||
throws ResourceRegistryException {
|
||||
|
||||
OClass oClass = SchemaManagementImpl.getTypeSchema(type, null);
|
||||
ERManagement erManagement = null;
|
||||
|
||||
if (oClass.isSubClassOf(Resource.NAME)) {
|
||||
erManagement = new ResourceManagement();
|
||||
} else if (oClass.isSubClassOf(Facet.NAME)) {
|
||||
erManagement = new FacetManagement();
|
||||
} else if (oClass.isSubClassOf(ConsistsOf.NAME)) {
|
||||
erManagement = new ConsistsOfManagement();
|
||||
} else if (oClass.isSubClassOf(IsRelatedTo.NAME)) {
|
||||
erManagement = new IsRelatedToManagement();
|
||||
}
|
||||
|
||||
if (erManagement == null) {
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not querable", type.toString()));
|
||||
}
|
||||
|
||||
erManagement.setElementType(type);
|
||||
return erManagement;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(OrientGraph orientGraph,
|
||||
Element element) throws ResourceRegistryException {
|
||||
if (element instanceof Vertex) {
|
||||
return EntityManagement.getEntityManagement(orientGraph,
|
||||
(Vertex) element);
|
||||
} else if (element instanceof Edge) {
|
||||
return RelationManagement.getRelationManagement(orientGraph,
|
||||
(Edge) element);
|
||||
}
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not a %s nor a %s", element.getClass().getSimpleName(),
|
||||
Entity.NAME, Relation.NAME));
|
||||
}
|
||||
|
||||
public static Element getAnyElementByUUID(UUID uuid) throws ERNotFoundException, ResourceRegistryException {
|
||||
try{
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, Vertex.class);
|
||||
}catch (ERNotFoundException e) {
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, Edge.class);
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ResourceRegistryException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagementFromUUID(OrientGraph orientGraph,
|
||||
UUID uuid) throws ResourceRegistryException {
|
||||
Element element;
|
||||
try {
|
||||
element = getAnyElementByUUID(uuid);
|
||||
return getERManagement(orientGraph, element);
|
||||
} catch (Exception e) {
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s does not belong to an %s nor to a %s",
|
||||
uuid.toString(), Entity.NAME, Relation.NAME));
|
||||
}
|
||||
}
|
||||
|
||||
protected ERManagement(AccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
package org.gcube.informationsystem.resourceregistry.er;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Entity;
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
import org.gcube.informationsystem.model.entity.Resource;
|
||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.relation.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.ConsistsOfManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.IsRelatedToManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
|
||||
import com.orientechnologies.orient.core.metadata.schema.OClass;
|
||||
import com.tinkerpop.blueprints.Edge;
|
||||
import com.tinkerpop.blueprints.Element;
|
||||
import com.tinkerpop.blueprints.Vertex;
|
||||
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
|
||||
|
||||
public class ERManagementUtility {
|
||||
|
||||
/*
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(AccessType querableType)
|
||||
throws ResourceRegistryException {
|
||||
switch (querableType) {
|
||||
case FACET:
|
||||
return new FacetManagement();
|
||||
|
||||
case RESOURCE:
|
||||
return new ResourceManagement();
|
||||
|
||||
case IS_RELATED_TO:
|
||||
return new IsRelatedToManagement();
|
||||
|
||||
case CONSISTS_OF:
|
||||
return new ConsistsOfManagement();
|
||||
|
||||
default:
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not querable", querableType.toString()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(String type)
|
||||
throws ResourceRegistryException {
|
||||
|
||||
OClass oClass = SchemaManagementImpl.getTypeSchema(type, null);
|
||||
ERManagement erManagement = null;
|
||||
|
||||
if (oClass.isSubClassOf(Resource.NAME)) {
|
||||
erManagement = new ResourceManagement();
|
||||
} else if (oClass.isSubClassOf(Facet.NAME)) {
|
||||
erManagement = new FacetManagement();
|
||||
} else if (oClass.isSubClassOf(ConsistsOf.NAME)) {
|
||||
erManagement = new ConsistsOfManagement();
|
||||
} else if (oClass.isSubClassOf(IsRelatedTo.NAME)) {
|
||||
erManagement = new IsRelatedToManagement();
|
||||
}
|
||||
|
||||
if (erManagement == null) {
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not querable", type.toString()));
|
||||
}
|
||||
|
||||
erManagement.setElementType(type);
|
||||
return erManagement;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static ERManagement getERManagement(OrientGraph orientGraph,
|
||||
Element element) throws ResourceRegistryException {
|
||||
if (element instanceof Vertex) {
|
||||
return EntityManagement.getEntityManagement(orientGraph,
|
||||
(Vertex) element);
|
||||
} else if (element instanceof Edge) {
|
||||
return RelationManagement.getRelationManagement(orientGraph,
|
||||
(Edge) element);
|
||||
}
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s is not a %s nor a %s", element.getClass().getSimpleName(),
|
||||
Entity.NAME, Relation.NAME));
|
||||
}
|
||||
|
||||
public static Element getAnyElementByUUID(UUID uuid) throws ERNotFoundException, ResourceRegistryException {
|
||||
try{
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, Vertex.class);
|
||||
}catch (ERNotFoundException e) {
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, Edge.class);
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ResourceRegistryException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Element getAnyElementByUUID(OrientGraph orientGraph, UUID uuid) throws ERNotFoundException, ResourceRegistryException {
|
||||
try{
|
||||
return Utility.getElementByUUID(orientGraph, null, uuid, Vertex.class);
|
||||
}catch (ERNotFoundException e) {
|
||||
return Utility.getElementByUUID(orientGraph, null, uuid, Edge.class);
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ResourceRegistryException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagementFromUUID(OrientGraph orientGraph,
|
||||
UUID uuid) throws ResourceRegistryException {
|
||||
Element element;
|
||||
try {
|
||||
element = getAnyElementByUUID(orientGraph, uuid);
|
||||
return getERManagement(orientGraph, element);
|
||||
} catch (Exception e) {
|
||||
throw new ResourceRegistryException(String.format(
|
||||
"%s does not belong to an %s nor to a %s",
|
||||
uuid.toString(), Entity.NAME, Relation.NAME));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAvailabl
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -108,7 +109,7 @@ public abstract class EntityManagement<E extends Entity> extends
|
|||
|
||||
} catch (ERNotFoundException e) {
|
||||
try {
|
||||
Element el = getAnyElementByUUID(uuid);
|
||||
Element el = ERManagementUtility.getAnyElementByUUID(uuid);
|
||||
String error = String.format(
|
||||
"UUID %s is already used by another %s. This is not allowed.",
|
||||
uuid.toString(), (el instanceof Vertex) ? Entity.NAME : Relation.NAME);
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.er.relation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.AccessType;
|
||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.consistsOf.ConsistsOfAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.consistsOf.ConsistsOfAvailableInAnotherContextException;
|
||||
|
@ -43,5 +46,19 @@ public class ConsistsOfManagement extends RelationManagement<ConsistsOf, Resourc
|
|||
protected ConsistsOfAlreadyPresentException getSpecificERAlreadyPresentException(String message) {
|
||||
return new ConsistsOfAlreadyPresentException(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceManagement getSourceEntityManagement(UUID sourceUUID) throws ResourceRegistryException {
|
||||
ResourceManagement resourceManagement = new ResourceManagement(orientGraph);
|
||||
resourceManagement.setUUID(sourceUUID);
|
||||
return resourceManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FacetManagement getTargetEntityManagement(UUID targetUUID) throws ResourceRegistryException {
|
||||
FacetManagement facetManagement = new FacetManagement(orientGraph);
|
||||
facetManagement.setUUID(targetUUID);
|
||||
return facetManagement;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.er.relation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.AccessType;
|
||||
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.isrelatedto.IsRelatedToAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.isrelatedto.IsRelatedToAvailableInAnotherContextException;
|
||||
|
@ -43,4 +46,18 @@ public class IsRelatedToManagement extends RelationManagement<IsRelatedTo, Resou
|
|||
return new IsRelatedToAlreadyPresentException(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceManagement getSourceEntityManagement(UUID sourceUUID) throws ResourceRegistryException {
|
||||
ResourceManagement resourceManagement = new ResourceManagement(orientGraph);
|
||||
resourceManagement.setUUID(sourceUUID);
|
||||
return resourceManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceManagement getTargetEntityManagement(UUID targetUUID) throws ResourceRegistryException {
|
||||
ResourceManagement resourceManagement = new ResourceManagement(orientGraph);
|
||||
resourceManagement.setUUID(targetUUID);
|
||||
return resourceManagement;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement;
|
||||
|
@ -303,6 +304,10 @@ public abstract class RelationManagement<R extends Relation, S extends EntityMan
|
|||
return element;
|
||||
}
|
||||
|
||||
protected abstract S getSourceEntityManagement(UUID sourceUUID) throws ResourceRegistryException;
|
||||
|
||||
protected abstract T getTargetEntityManagement(UUID targetUUID) throws ResourceRegistryException;
|
||||
|
||||
|
||||
public void setSourceEntityManagement(S sourceEntityManagement) {
|
||||
this.sourceEntityManagement = sourceEntityManagement;
|
||||
|
@ -311,15 +316,13 @@ public abstract class RelationManagement<R extends Relation, S extends EntityMan
|
|||
public void setTargetEntityManagement(T targetEntityManagement) {
|
||||
this.targetEntityManagement = targetEntityManagement;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public void setSourceUUID(UUID sourceUUID) throws ResourceRegistryException {
|
||||
this.sourceEntityManagement = (S) ERManagement.getERManagementFromUUID(orientGraph, sourceUUID);
|
||||
this.sourceEntityManagement = getSourceEntityManagement(sourceUUID);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setTargetUUID(UUID targetUUID) throws ResourceRegistryException {
|
||||
this.targetEntityManagement = (T) ERManagement.getERManagementFromUUID(orientGraph, targetUUID);
|
||||
this.targetEntityManagement = getTargetEntityManagement(targetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -722,8 +725,7 @@ public abstract class RelationManagement<R extends Relation, S extends EntityMan
|
|||
boolean polymorphic) throws ResourceRegistryException {
|
||||
EntityManagement entityManagement = null;
|
||||
try {
|
||||
entityManagement = (EntityManagement) ERManagement
|
||||
.getERManagementFromUUID(orientGraph, uuid);
|
||||
entityManagement = (EntityManagement) ERManagementUtility.getERManagementFromUUID(orientGraph, uuid);
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -31,9 +31,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.query.Invalid
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPCall.HTTPMETHOD;
|
||||
import org.gcube.informationsystem.resourceregistry.context.OLDContextManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.context.ContextManagementImpl;
|
||||
import org.gcube.informationsystem.resourceregistry.context.OLDContextManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement;
|
||||
|
@ -106,7 +107,7 @@ public class Access {
|
|||
|
||||
logger.info("Requested to check if {} with id {} exists", type, id);
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagement.getERManagement(type);
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(id);
|
||||
|
@ -152,7 +153,7 @@ public class Access {
|
|||
logger.info("Requested {} with id {}", type, id);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagement.getERManagement(type);
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(id);
|
||||
|
@ -180,7 +181,7 @@ public class Access {
|
|||
logger.info("Requested {} ({}={}) instances", type,
|
||||
AccessPath.POLYMORPHIC_PARAM, polymorphic);
|
||||
|
||||
ERManagement erManagement = ERManagement.getERManagement(type);
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
|
||||
if (erManagement instanceof EntityManagement) {
|
||||
return erManagement.all(polymorphic);
|
||||
|
@ -263,7 +264,7 @@ public class Access {
|
|||
constraint.put(AccessPath.RELATION_TYPE_PATH_PART, relationType);
|
||||
constraint.put(AccessPath.FACET_TYPE_PATH_PART, facetType);
|
||||
|
||||
ERManagement erManagement = ERManagement.getERManagement(type);
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
|
||||
if (erManagement instanceof ResourceManagement) {
|
||||
return ((ResourceManagement) erManagement).all(polymorphic, constraint);
|
||||
|
|
|
@ -544,7 +544,7 @@ public class ERManagementTest extends ScopedTest {
|
|||
|
||||
/* Getting all instances of created specific Resources*/
|
||||
for(String key : resources.keySet()){
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(key);
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagementUtility.getERManagement(key);
|
||||
String json = resourceManagement.all(false);
|
||||
|
||||
List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
@ -555,7 +555,7 @@ public class ERManagementTest extends ScopedTest {
|
|||
|
||||
/* Getting all Resources polymorphic and non polymorphic */
|
||||
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagement.getERManagement(Resource.NAME);
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagementUtility.getERManagement(Resource.NAME);
|
||||
|
||||
String json = resourceManagement.all(true);
|
||||
List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
@ -570,7 +570,7 @@ public class ERManagementTest extends ScopedTest {
|
|||
|
||||
/* Getting all IsRelatedTo polymorphic and non polymorphic */
|
||||
|
||||
IsRelatedToManagement isRelatedToManagement = (IsRelatedToManagement) ERManagement.getERManagement(IsRelatedTo.NAME);
|
||||
IsRelatedToManagement isRelatedToManagement = (IsRelatedToManagement) ERManagementUtility.getERManagement(IsRelatedTo.NAME);
|
||||
|
||||
json = isRelatedToManagement.all(true);
|
||||
|
||||
|
@ -588,7 +588,7 @@ public class ERManagementTest extends ScopedTest {
|
|||
|
||||
/* Getting all ConsistsOf polymorphic and non polymorphic */
|
||||
|
||||
ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagement.getERManagement(ConsistsOf.NAME);
|
||||
ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagementUtility.getERManagement(ConsistsOf.NAME);
|
||||
|
||||
json = consistsOfManagement.all(true);
|
||||
List<Resource> consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.er.ERManagementUtility;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,7 +35,7 @@ public class ResourceManagementTest extends ScopedTest {
|
|||
String type = Service.NAME;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagement.getERManagement(type);
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
|
||||
if (erManagement instanceof ResourceManagement) {
|
||||
String ret = ((ResourceManagement) erManagement).all(false, constraint);
|
||||
|
|
Loading…
Reference in New Issue