Changed '@class' to 'type'

This commit is contained in:
Luca Frosini 2023-04-26 21:44:03 +02:00
parent 39556110c2
commit ff68eb6f28
49 changed files with 274 additions and 239 deletions

View File

@ -17,8 +17,8 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecur
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility; import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -167,7 +167,7 @@ public class ContextUtility {
ODatabaseDocument oDatabaseDocument = null; ODatabaseDocument oDatabaseDocument = null;
try { try {
oDatabaseDocument = getAdminSecurityContext().getDatabaseDocument(PermissionMode.READER); oDatabaseDocument = getAdminSecurityContext().getDatabaseDocument(PermissionMode.READER);
OVertex oVertex = Utility.getElementByUUID(oDatabaseDocument, Context.NAME, uuid, OVertex oVertex = OrientDBUtility.getElementByUUID(oDatabaseDocument, Context.NAME, uuid,
OVertex.class); OVertex.class);
return oVertex; return oVertex;
} finally { } finally {
@ -235,7 +235,7 @@ public class ContextUtility {
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OVertex context = ElementManagementUtility.getElementFromOptional(oResult.getVertex()); OVertex context = ElementManagementUtility.getElementFromOptional(oResult.getVertex());
logger.trace("Context Representing Vertex : {}", Utility.toJsonString(context, true)); logger.trace("Context Representing Vertex : {}", OrientDBUtility.getAsStringForLogging(context));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ContextNotFoundException("Found more than one context with name " + name throw new ContextNotFoundException("Found more than one context with name " + name

View File

@ -33,7 +33,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityCo
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
import org.gcube.informationsystem.resourceregistry.queries.operators.QueryConditionalOperator; import org.gcube.informationsystem.resourceregistry.queries.operators.QueryConditionalOperator;
import org.gcube.informationsystem.resourceregistry.queries.operators.QueryLogicalOperator; import org.gcube.informationsystem.resourceregistry.queries.operators.QueryLogicalOperator;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.utils.UUIDManager; import org.gcube.informationsystem.utils.UUIDManager;
@ -193,7 +193,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
((ObjectNode) context).replace(Context.PARENT_PROPERTY, isParentOf); ((ObjectNode) context).replace(Context.PARENT_PROPERTY, isParentOf);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); logger.error("Unable to correctly serialize {}. {}", edge, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ContextException(""); throw new ContextException("");
} }
} }
@ -207,10 +207,10 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
JsonNode isParentOf = isParentOfManagement.serializeAsJsonNode(); JsonNode isParentOf = isParentOfManagement.serializeAsJsonNode();
context = addRelation(context, isParentOf, Context.CHILDREN_PROPERTY); context = addRelation(context, isParentOf, Context.CHILDREN_PROPERTY);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); logger.error("Unable to correctly serialize {}. {}", edge, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); logger.error("Unable to correctly serialize {}. {}", edge, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }
} }
@ -286,7 +286,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
for (OVertex p : iterable) { for (OVertex p : iterable) {
if (found) { if (found) {
String message = String.format("{} has more than one parent. {}", Context.NAME, String message = String.format("{} has more than one parent. {}", Context.NAME,
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(message.toString()); throw new ResourceRegistryException(message.toString());
} }
parent = p; parent = p;
@ -370,7 +370,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
if (edgeIterator.hasNext()) { if (edgeIterator.hasNext()) {
throw new ContextException( throw new ContextException(
"Seems that the Context has more than one Parent. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); "Seems that the Context has more than one Parent. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
@ -419,7 +419,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
arrayNode.add(jsonObject); arrayNode.add(jsonObject);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
vertex.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); vertex.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
try { try {

View File

@ -18,7 +18,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextMan
import org.gcube.informationsystem.resourceregistry.contexts.security.ContextSecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.ContextSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
@ -88,10 +88,10 @@ public class IsParentOfManagement extends RelationElementManagement<ContextManag
} }
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }

View File

@ -19,7 +19,7 @@ import org.gcube.informationsystem.contexts.reference.entities.Context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility; import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.utils.UUIDManager; import org.gcube.informationsystem.utils.UUIDManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -165,7 +165,7 @@ public class SecurityContext {
errorMessage.append(" to non hierarchic "); errorMessage.append(" to non hierarchic ");
errorMessage.append(SecurityContext.class.getSimpleName()); errorMessage.append(SecurityContext.class.getSimpleName());
errorMessage.append(". "); errorMessage.append(". ");
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
final String error = errorMessage.toString(); final String error = errorMessage.toString();
logger.error(error); logger.error(error);
throw new RuntimeException(error); throw new RuntimeException(error);

View File

@ -49,7 +49,7 @@ import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient; import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient;
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility; import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
@ -547,7 +547,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
if(uuid == null) { if(uuid == null) {
throw new NotFoundException("null UUID does not allow to retrieve the Element"); throw new NotFoundException("null UUID does not allow to retrieve the Element");
} }
return Utility.getElementByUUID(oDatabaseDocument, typeName == null ? accessType.getName() : typeName, uuid, return OrientDBUtility.getElementByUUID(oDatabaseDocument, typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificNotFoundException(e); throw getSpecificNotFoundException(e);
@ -560,7 +560,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
public El retrieveElementFromAnyContext() throws NotFoundException, ResourceRegistryException { public El retrieveElementFromAnyContext() throws NotFoundException, ResourceRegistryException {
try { try {
return Utility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid, return OrientDBUtility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificNotFoundException(e); throw getSpecificNotFoundException(e);
@ -1141,7 +1141,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
if(key.compareTo(IdentifiableElement.METADATA_PROPERTY) == 0) { if(key.compareTo(IdentifiableElement.METADATA_PROPERTY) == 0) {
// Keeping the metadata // Keeping the metadata
MetadataOrient metadataOrient = MetadataUtility.getMetadataOrient((ODocument) object); MetadataOrient metadataOrient = MetadataUtility.getMetadataOrient((ODocument) object);
JsonNode metadataJson = Utility.toJsonNode(metadataOrient, false); JsonNode metadataJson = OrientDBUtility.toJsonNode(metadataOrient);
if(ContextUtility.getIncludeInstanceContexts().get()) { if(ContextUtility.getIncludeInstanceContexts().get()) {
((ObjectNode) metadataJson).set(Metadata.__CONTEXTS, getContextsAsObjectNode()); ((ObjectNode) metadataJson).set(Metadata.__CONTEXTS, getContextsAsObjectNode());
} }

View File

@ -20,7 +20,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.relations.Co
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement;
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -81,9 +81,9 @@ public class ElementManagementUtility {
public static OElement getAnyElementByUUID(UUID uuid) throws NotFoundException, ResourceRegistryException { public static OElement getAnyElementByUUID(UUID uuid) throws NotFoundException, ResourceRegistryException {
try { try {
return Utility.getElementByUUIDAsAdmin(null, uuid, OVertex.class); return OrientDBUtility.getElementByUUIDAsAdmin(null, uuid, OVertex.class);
} catch(NotFoundException e) { } catch(NotFoundException e) {
return Utility.getElementByUUIDAsAdmin(null, uuid, OEdge.class); return OrientDBUtility.getElementByUUIDAsAdmin(null, uuid, OEdge.class);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
@ -94,9 +94,9 @@ public class ElementManagementUtility {
public static OElement getAnyElementByUUID(ODatabaseDocument oDatabaseDocument, UUID uuid) public static OElement getAnyElementByUUID(ODatabaseDocument oDatabaseDocument, UUID uuid)
throws NotFoundException, ResourceRegistryException { throws NotFoundException, ResourceRegistryException {
try { try {
return Utility.getElementByUUID(oDatabaseDocument, null, uuid, OVertex.class); return OrientDBUtility.getElementByUUID(oDatabaseDocument, null, uuid, OVertex.class);
} catch(NotFoundException e) { } catch(NotFoundException e) {
return Utility.getElementByUUID(oDatabaseDocument, null, uuid, OEdge.class); return OrientDBUtility.getElementByUUID(oDatabaseDocument, null, uuid, OEdge.class);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
@ -121,12 +121,12 @@ public class ElementManagementUtility {
if(oDatabaseDocument == null) { if(oDatabaseDocument == null) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
ODatabaseDocument.class.getSimpleName() + "instance is null. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); ODatabaseDocument.class.getSimpleName() + "instance is null. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
if(vertex == null) { if(vertex == null) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
OVertex.class.getSimpleName() + "instance is null. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OVertex.class.getSimpleName() + "instance is null. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
OClass oClass = null; OClass oClass = null;
@ -134,7 +134,7 @@ public class ElementManagementUtility {
oClass = ElementManagementUtility.getOClass(vertex); oClass = ElementManagementUtility.getOClass(vertex);
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Unable to detect type of %s. %s", vertex.toString(), String error = String.format("Unable to detect type of %s. %s", vertex.toString(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.error(error, e); logger.error(error, e);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
@ -146,7 +146,7 @@ public class ElementManagementUtility {
entityManagement = new FacetManagement(); entityManagement = new FacetManagement();
} else { } else {
String error = String.format("{%s is not a %s nor a %s. %s", vertex, Resource.NAME, Facet.NAME, String error = String.format("{%s is not a %s nor a %s. %s", vertex, Resource.NAME, Facet.NAME,
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
entityManagement.setODatabaseDocument(oDatabaseDocument); entityManagement.setODatabaseDocument(oDatabaseDocument);
@ -160,12 +160,12 @@ public class ElementManagementUtility {
if(oDatabaseDocument == null) { if(oDatabaseDocument == null) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
ODatabaseDocument.class.getSimpleName() + "instance is null. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); ODatabaseDocument.class.getSimpleName() + "instance is null. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
if(edge == null) { if(edge == null) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
OEdge.class.getSimpleName() + "instance is null. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OEdge.class.getSimpleName() + "instance is null. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
OClass oClass = ElementManagementUtility.getOClass(edge); OClass oClass = ElementManagementUtility.getOClass(edge);
@ -177,7 +177,7 @@ public class ElementManagementUtility {
relationManagement = new IsRelatedToManagement(); relationManagement = new IsRelatedToManagement();
} else { } else {
String error = String.format("{%s is not a %s nor a %s. %s", edge, ConsistsOf.NAME, IsRelatedTo.NAME, String error = String.format("{%s is not a %s nor a %s. %s", edge, ConsistsOf.NAME, IsRelatedTo.NAME,
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }

View File

@ -18,7 +18,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityCo
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
@ -85,7 +85,7 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
errorMessage.append(" point to the same "); errorMessage.append(" point to the same ");
errorMessage.append(elem.getClass().getSimpleName()); errorMessage.append(elem.getClass().getSimpleName());
errorMessage.append(". "); errorMessage.append(". ");
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(errorMessage.toString()); throw new ResourceRegistryException(errorMessage.toString());
} }
relationManagements.put(id, baseRelationManagement); relationManagements.put(id, baseRelationManagement);
@ -156,7 +156,7 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
} }
logger.info("Created {} is {}", OVertex.class.getSimpleName(), logger.info("Created {} is {}", OVertex.class.getSimpleName(),
Utility.toJsonString(element, true)); OrientDBUtility.getAsStringForLogging(element));
return element; return element;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {

View File

@ -26,6 +26,7 @@ import org.gcube.informationsystem.resourceregistry.types.CachedType;
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient; import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient;
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility; import org.gcube.informationsystem.resourceregistry.utils.UUIDUtility;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.utils.TypeUtility; import org.gcube.informationsystem.utils.TypeUtility;
@ -139,7 +140,7 @@ public class PropertyElementManagement {
public static JsonNode getJsonNode(ODocument oDocument) throws ResourceRegistryException { public static JsonNode getJsonNode(ODocument oDocument) throws ResourceRegistryException {
try { try {
String type = oDocument.getClassName(); String type = oDocument.getClassName();
String json = oDocument.toJSON("class"); String json = OrientDBUtility.toJsonString(oDocument);
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(json); JsonNode jsonNode = objectMapper.readTree(json);

View File

@ -16,7 +16,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaV
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.UUIDUtility; import org.gcube.informationsystem.utils.UUIDUtility;
@ -123,10 +123,10 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
} }
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }

View File

@ -6,7 +6,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.informationsystem.base.reference.Element;
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;
import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException;

View File

@ -6,7 +6,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation; import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation;
import org.gcube.informationsystem.utils.TypeUtility; import org.gcube.informationsystem.utils.TypeUtility;

View File

@ -40,7 +40,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.Operation;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement;
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
@ -212,7 +212,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
errorMessage.append(" point to the same "); errorMessage.append(" point to the same ");
errorMessage.append(elem.getClass().getSimpleName()); errorMessage.append(elem.getClass().getSimpleName());
errorMessage.append(". "); errorMessage.append(". ");
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(errorMessage.toString()); throw new ResourceRegistryException(errorMessage.toString());
} }
relationManagements.put(id, relationManagement); relationManagements.put(id, relationManagement);
@ -284,7 +284,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
} }
logger.debug("Created {} is {}", OVertex.class.getSimpleName(), logger.debug("Created {} is {}", OVertex.class.getSimpleName(),
Utility.toJsonString((OVertex) element, true)); OrientDBUtility.getAsStringForLogging((OVertex) element));
return element; return element;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
@ -505,7 +505,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
arrayNode.add(jsonNode); arrayNode.add(jsonNode);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
vertex.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); vertex.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
try { try {
@ -694,7 +694,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
arrayNode.add(node); arrayNode.add(node);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
vertex.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); vertex.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
} }
@ -722,7 +722,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
* SELECT FROM (TRAVERSE inE('isIdentifiedBy'), outV('EService') FROM (SELECT * SELECT FROM (TRAVERSE inE('isIdentifiedBy'), outV('EService') FROM (SELECT
* FROM SoftwareFacet WHERE group='VREManagement' AND name='SmartExecutor')) * FROM SoftwareFacet WHERE group='VREManagement' AND name='SmartExecutor'))
* *
* WHERE @class='EService' // Only is not polymorphic * WHERE type='EService' // Only is not polymorphic
*/ */
StringBuilder selectStringBuilder = new StringBuilder("SELECT FROM (TRAVERSE "); StringBuilder selectStringBuilder = new StringBuilder("SELECT FROM (TRAVERSE ");
@ -753,7 +753,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
selectStringBuilder.append(" ))"); selectStringBuilder.append(" ))");
if(!polymorphic) { if(!polymorphic) {
selectStringBuilder.append(" WHERE @class='"); selectStringBuilder.append(" WHERE type='");
selectStringBuilder.append(typeName); selectStringBuilder.append(typeName);
selectStringBuilder.append("'"); selectStringBuilder.append("'");
} }
@ -776,7 +776,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
oClass = ElementManagementUtility.getOClass(element); oClass = ElementManagementUtility.getOClass(element);
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Unable to detect type of %s. %s", element.toString(), String error = String.format("Unable to detect type of %s. %s", element.toString(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.error(error, e); logger.error(error, e);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
@ -802,7 +802,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
arrayNode.add(jsonNode); arrayNode.add(jsonNode);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
vertex.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); vertex.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }

View File

@ -32,7 +32,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.relations.Is
import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement;
import org.gcube.informationsystem.resourceregistry.types.CachedType; import org.gcube.informationsystem.resourceregistry.types.CachedType;
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
@ -104,7 +104,7 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
errorMessage.append("SourceEntityManagement for "); errorMessage.append("SourceEntityManagement for ");
errorMessage.append(relationManagement.getClass().getSimpleName()); errorMessage.append(relationManagement.getClass().getSimpleName());
errorMessage.append(" is not the one expected. "); errorMessage.append(" is not the one expected. ");
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(errorMessage.toString()); throw new ResourceRegistryException(errorMessage.toString());
} }
@ -114,10 +114,10 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
JsonNode consistsOf = relationManagement.serializeAsJsonNode(); JsonNode consistsOf = relationManagement.serializeAsJsonNode();
sourceResource = addConsistsOf(sourceResource, consistsOf); sourceResource = addConsistsOf(sourceResource, consistsOf);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); logger.error("Unable to correctly serialize {}. {}", edge, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); logger.error("Unable to correctly serialize {}. {}", edge, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }
@ -234,8 +234,8 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
} else if(oClass.isSubClassOf(ConsistsOf.NAME)) { } else if(oClass.isSubClassOf(ConsistsOf.NAME)) {
relationManagement = new ConsistsOfManagement(); relationManagement = new ConsistsOfManagement();
} else { } else {
logger.warn("{} is not a {} nor a {}. {}", Utility.toJsonString(edge, true), IsRelatedTo.NAME, logger.warn("{} is not a {} nor a {}. {}", OrientDBUtility.getAsStringForLogging(edge), IsRelatedTo.NAME,
ConsistsOf.NAME, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); ConsistsOf.NAME, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
if(relationManagement != null) { if(relationManagement != null) {
relationManagement.setWorkingContext(getWorkingContext()); relationManagement.setWorkingContext(getWorkingContext());

View File

@ -19,7 +19,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.relations.isr
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException; import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException;
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
@ -88,10 +88,10 @@ public class IsRelatedToManagement extends RelationManagement<ResourceManagement
} }
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to correctly serialize {}. {}", element, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e); logger.error("Unable to correctly serialize {}. {}", element, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE, e);
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }

View File

@ -42,7 +42,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Res
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
import org.gcube.informationsystem.resourceregistry.utils.PropagationConstraintOrient; import org.gcube.informationsystem.resourceregistry.utils.PropagationConstraintOrient;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
@ -219,7 +219,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
} else { } else {
String error = String.format("{%s is not a %s nor a %s. %s", this, String error = String.format("{%s is not a %s nor a %s. %s", this,
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(), IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
} }
@ -231,7 +231,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
} else { } else {
String error = String.format("{%s is not a %s nor a %s. %s", this, String error = String.format("{%s is not a %s nor a %s. %s", this,
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(), IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
@ -253,10 +253,10 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
propagationConstraint = (PropagationConstraint) oDocument; propagationConstraint = (PropagationConstraint) oDocument;
} else { } else {
try { try {
propagationConstraint = ElementMapper.unmarshal(PropagationConstraint.class, oDocument.toJSON()); propagationConstraint = ElementMapper.unmarshal(PropagationConstraint.class, OrientDBUtility.toJsonString(oDocument));
} catch(Exception e) { } catch(Exception e) {
logger.warn("Unable to recreate {}. {}", PropagationConstraint.NAME, logger.warn("Unable to recreate {}. {}", PropagationConstraint.NAME,
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
@ -406,21 +406,21 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
AddConstraint addConstraint = AddConstraint.unpropagate; AddConstraint addConstraint = AddConstraint.unpropagate;
try { try {
propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element, propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class, element,
Relation.PROPAGATION_CONSTRAINT_PROPERTY); Relation.PROPAGATION_CONSTRAINT_PROPERTY);
if(propagationConstraint.getAddConstraint() != null) { if(propagationConstraint.getAddConstraint() != null) {
addConstraint = propagationConstraint.getAddConstraint(); addConstraint = propagationConstraint.getAddConstraint();
} else { } else {
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY, String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
PropagationConstraint.ADD_PROPERTY, Utility.toJsonString(element, true), PropagationConstraint.ADD_PROPERTY, OrientDBUtility.getAsStringForException(element),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.error(error); logger.error(error);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Error while getting %s from %s while performing AddToContext. %s", String error = String.format("Error while getting %s from %s while performing AddToContext. %s",
Relation.PROPAGATION_CONSTRAINT_PROPERTY, Utility.toJsonString(element, true), Relation.PROPAGATION_CONSTRAINT_PROPERTY, OrientDBUtility.getAsStringForException(element),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.warn(error); logger.warn(error);
throw new ResourceRegistryException(error, e); throw new ResourceRegistryException(error, e);
} }
@ -561,21 +561,21 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
RemoveConstraint removeConstraint = RemoveConstraint.keep; RemoveConstraint removeConstraint = RemoveConstraint.keep;
try { try {
propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element, propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class, element,
Relation.PROPAGATION_CONSTRAINT_PROPERTY); Relation.PROPAGATION_CONSTRAINT_PROPERTY);
if(propagationConstraint.getRemoveConstraint() != null) { if(propagationConstraint.getRemoveConstraint() != null) {
removeConstraint = propagationConstraint.getRemoveConstraint(); removeConstraint = propagationConstraint.getRemoveConstraint();
} else { } else {
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY, String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true), PropagationConstraint.REMOVE_PROPERTY, OrientDBUtility.getAsStringForException(element),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.error(error); logger.error(error);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Error while getting %s from %s while performing RemoveFromContext. %s", String error = String.format("Error while getting %s from %s while performing RemoveFromContext. %s",
Relation.PROPAGATION_CONSTRAINT_PROPERTY, Utility.toJsonString(element, true), Relation.PROPAGATION_CONSTRAINT_PROPERTY, OrientDBUtility.getAsStringForException(element),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.error(error); logger.error(error);
throw new ResourceRegistryException(error, e); throw new ResourceRegistryException(error, e);
@ -722,29 +722,22 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
DeleteConstraint deleteConstraint = DeleteConstraint.keep; DeleteConstraint deleteConstraint = DeleteConstraint.keep;
try { try {
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, PropagationConstraint propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class,
element, Relation.PROPAGATION_CONSTRAINT_PROPERTY); element, Relation.PROPAGATION_CONSTRAINT_PROPERTY);
if(propagationConstraint.getDeleteConstraint() != null) { if(propagationConstraint.getDeleteConstraint() != null) {
deleteConstraint = propagationConstraint.getDeleteConstraint(); deleteConstraint = propagationConstraint.getDeleteConstraint();
} else { } else {
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY, String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
PropagationConstraint.DELETE_PROPERTY, Utility.toJsonString(element, true), PropagationConstraint.DELETE_PROPERTY, OrientDBUtility.getAsStringForException(element),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
logger.warn(error);
// logger.error(error);
// TODO Added for backward compatibility
deleteConstraint = DeleteConstraint.values()[propagationConstraint.getRemoveConstraint().ordinal()]; deleteConstraint = DeleteConstraint.values()[propagationConstraint.getRemoveConstraint().ordinal()];
/* throw new ResourceRegistryException(error);
* TODO Restore the exception raising and remove the line above
*
* throw new ResourceRegistryException(error);
*/
} }
} catch(Exception e) { } catch(Exception e) {
logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT_PROPERTY, logger.warn("Error while getting {} from {}. Assuming {}. {}", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
Utility.toJsonString(element, true), deleteConstraint, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.getAsStringForException(element), deleteConstraint, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
// pre-loading target entity because after deleting the relation we will not be able to get it // pre-loading target entity because after deleting the relation we will not be able to get it

View File

@ -10,7 +10,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityCo
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -52,10 +52,10 @@ public class QueryImpl implements Query {
if(raw) { if(raw) {
if(oResult.isElement()) { if(oResult.isElement()) {
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement()); OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
jsonNode = Utility.toJsonNode(element, false); jsonNode = OrientDBUtility.toJsonNode(element);
}else { }else {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
jsonNode = mapper.readTree(oResult.toJSON()); jsonNode = mapper.readTree(OrientDBUtility.toJsonString(oResult));
} }
} else { } else {
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement()); OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
@ -67,7 +67,7 @@ public class QueryImpl implements Query {
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
oResult.toJSON(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); OrientDBUtility.toJsonString(oResult), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }

View File

@ -25,7 +25,7 @@ import org.gcube.informationsystem.resourceregistry.queries.json.base.relations.
import org.gcube.informationsystem.resourceregistry.queries.json.base.relations.JsonQueryIsRelatedTo; import org.gcube.informationsystem.resourceregistry.queries.json.base.relations.JsonQueryIsRelatedTo;
import org.gcube.informationsystem.resourceregistry.types.CachedType; import org.gcube.informationsystem.resourceregistry.types.CachedType;
import org.gcube.informationsystem.resourceregistry.types.TypesCache; import org.gcube.informationsystem.resourceregistry.types.TypesCache;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.utils.TypeUtility; import org.gcube.informationsystem.utils.TypeUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -136,7 +136,7 @@ public class JsonQuery {
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument, ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
element); element);
// To support polymorphism we do not include @class="TypeName" in query. So we need post processing filtering of results // To support polymorphism we do not include ="TypeName" in query. So we need post processing filtering of results
String requestedType = entryPoint.getType(); String requestedType = entryPoint.getType();
String gotType = erManagement.getTypeName(); String gotType = erManagement.getTypeName();
@ -157,7 +157,7 @@ public class JsonQuery {
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
element.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); element.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }

View File

@ -61,7 +61,7 @@ public class JsonQueryFacet extends JsonQueryEntity {
newBuffer.append(")"); newBuffer.append(")");
} }
// Size 1 means that only '@class' property is present // Size 1 means that only 'type' property is present
if(size > 1) { if(size > 1) {
newBuffer.append(" WHERE "); newBuffer.append(" WHERE ");
newBuffer.append(addConstraints(jsonNode, null, null)); newBuffer.append(addConstraints(jsonNode, null, null));

View File

@ -79,7 +79,7 @@ public class JsonQueryConsistsOf extends JsonQueryRelation {
consistsOfBuffer.append(stringBuffer); consistsOfBuffer.append(stringBuffer);
consistsOfBuffer.append(")"); // Close ) 2 consistsOfBuffer.append(")"); // Close ) 2
// Size 2 means that only '@class' and 'target' properties are present // Size 2 means that only 'type' and 'target' properties are present
if(size > 2) { if(size > 2) {
consistsOfBuffer.append(") WHERE "); // Close ) SELECT consistsOfBuffer.append(") WHERE "); // Close ) SELECT
consistsOfBuffer.append(addConstraints(jsonNode, null, null)); consistsOfBuffer.append(addConstraints(jsonNode, null, null));

View File

@ -33,7 +33,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
int size = jsonNode.size(); int size = jsonNode.size();
// Remove @class from size // Remove type from size
--size; --size;
if(jsonNode.has(IsRelatedTo.SOURCE_PROPERTY)) { if(jsonNode.has(IsRelatedTo.SOURCE_PROPERTY)) {
@ -72,7 +72,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
stringBuffer = buffer; stringBuffer = buffer;
// Size 0 means that only '@class' and 'target'/'source' properties are present // Size 0 means that only 'type' and 'target'/'source' properties are present
if(size > 0) { if(size > 0) {
if(!entryPoint) { if(!entryPoint) {
stringBuffer.append(" )"); // Close ) SELECT stringBuffer.append(" )"); // Close ) SELECT

View File

@ -19,7 +19,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityCo
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
import org.gcube.informationsystem.resourceregistry.queries.json.JsonQuery; import org.gcube.informationsystem.resourceregistry.queries.json.JsonQuery;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -185,7 +185,7 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OVertex queryTemplate = ElementManagementUtility.getElementFromOptional(oResult.getVertex()); OVertex queryTemplate = ElementManagementUtility.getElementFromOptional(oResult.getVertex());
logger.trace("{} representing vertex is {}", QueryTemplate.NAME, Utility.toJsonString(queryTemplate, true)); logger.trace("{} representing vertex is {}", QueryTemplate.NAME, OrientDBUtility.getAsStringForLogging(queryTemplate));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
resultSet.close(); resultSet.close();
@ -264,7 +264,7 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
arrayNode.add(jsonObject); arrayNode.add(jsonObject);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}", logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
vertex.toString(), Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); vertex.toString(), OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
try { try {

View File

@ -258,30 +258,30 @@ public class Access extends BaseRest {
* Content Body example: * Content Body example:
* *
* { * {
* "@class": "EService", * "": "EService",
* "consistsOf": [ * "consistsOf": [
* { * {
* "@class": "ConsistsOf", * "": "ConsistsOf",
* "propagationConstraint" : { * "propagationConstraint" : {
* "add": "propagate" * "add": "propagate"
* }, * },
* "target": { * "target": {
* "@class": "StateFacet", * "": "StateFacet",
* "value": "down" * "value": "down"
* } * }
* }, * },
* { * {
* "@class": "IsIdentifiedBy", * "": "IsIdentifiedBy",
* "target": { * "target": {
* "@class": "SoftwareFacet", * "": "SoftwareFacet",
* "name": "data-transfer-service", * "name": "data-transfer-service",
* "group": "DataTransfer" * "group": "DataTransfer"
* } * }
* }, * },
* { * {
* "@class": "ConsistsOf", * "": "ConsistsOf",
* "target": { * "target": {
* "@class": "AccessPointFacet", * "": "AccessPointFacet",
* "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" * "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
* } * }
* } * }

View File

@ -58,11 +58,11 @@ public class QueryTemplateManager {
* "description" : "The following query return all the EService having the state provided as parameters, e.g. down, ready. * "description" : "The following query return all the EService having the state provided as parameters, e.g. down, ready.
* The content of the request to run this query template will be something like {\"$state\": "ready"}", * The content of the request to run this query template will be something like {\"$state\": "ready"}",
* "template": { * "template": {
* "@class": "EService", * "type": "EService",
* "consistsOf": [{ * "consistsOf": [{
* "@class": "ConsistsOf", * "type": "ConsistsOf",
* "target": { * "target": {
* "@class": "StateFacet", * "type": "StateFacet",
* "value": "$state" * "value": "$state"
* } * }
* }] * }]

View File

@ -64,9 +64,9 @@ public class SharingManager {
* The the body is the following * The the body is the following
* *
* [ * [
* {"@class" : "HostingNode", "uuid" : "16032d09-3823-444e-a1ff-a67de4f350a8" }, * {"type" : "HostingNode", "uuid" : "16032d09-3823-444e-a1ff-a67de4f350a8" },
* {"@class" : "Hosts", "uuid" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"}, * {"type" : "Hosts", "uuid" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"},
* {"@class" : "EService", "uuid" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"} * {"type" : "EService", "uuid" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"}
* ] * ]
* *
* *

View File

@ -17,7 +17,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.TypeSecuri
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.TypeMapper; import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -139,7 +139,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OVertex element = (OVertex) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OVertex element = (OVertex) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), OrientDBUtility.getAsStringForLogging(element));
if (resultSet.hasNext()) { if (resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
@ -168,7 +168,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
logger.debug("Created {} is {}", OVertex.class.getSimpleName(), Utility.toJsonString(element, true)); logger.debug("Created {} is {}", OVertex.class.getSimpleName(), OrientDBUtility.getAsStringForLogging(element));
return element; return element;
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {

View File

@ -16,7 +16,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.TypeSecuri
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -146,7 +146,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OElement element = (OElement) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OElement element = (OElement) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), OrientDBUtility.getAsStringForLogging(element));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
@ -169,7 +169,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
logger.debug("Created {} is {}", PropertyType.NAME, Utility.toJsonString(element, true)); logger.debug("Created {} is {}", PropertyType.NAME, OrientDBUtility.getAsStringForLogging(element));
return element; return element;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {

View File

@ -21,7 +21,7 @@ import org.gcube.informationsystem.resourceregistry.instances.base.ElementManage
import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement;
import org.gcube.informationsystem.resourceregistry.types.entities.EntityTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.EntityTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
@ -176,7 +176,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OEdge element = (OEdge) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OEdge element = (OEdge) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), OrientDBUtility.getAsStringForLogging(element));
if (resultSet.hasNext()) { if (resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()

View File

@ -37,9 +37,10 @@ public class EncryptedOrient extends ODocument {
@Override @Override
public String toJSON(String iFormat) { public String toJSON(String iFormat) {
return super.toJSON(iFormat); String ret = super.toJSON(iFormat);
ret = OrientDBUtility.replaceType(ret);
return ret;
} }
public String getDecryptedValue() { public String getDecryptedValue() {
return decryptedValue; return decryptedValue;

View File

@ -78,4 +78,11 @@ public class MetadataOrient extends ODocument implements Metadata {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public String toJSON(String iFormat) {
String ret = super.toJSON(iFormat);
ret = OrientDBUtility.replaceType(ret);
return ret;
}
} }

View File

@ -8,7 +8,9 @@ import java.util.Date;
import org.gcube.com.fasterxml.jackson.core.JsonParseException; import org.gcube.com.fasterxml.jackson.core.JsonParseException;
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException; import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider; import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.model.reference.properties.Metadata;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -56,11 +58,13 @@ public class MetadataUtility {
public static Metadata getMetadata(JsonNode jsonNode) public static Metadata getMetadata(JsonNode jsonNode)
throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException { throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException {
if(jsonNode.has(IdentifiableElement.METADATA_PROPERTY)) { if(jsonNode.has(IdentifiableElement.METADATA_PROPERTY)) {
JsonNode metadataNode = jsonNode.get(IdentifiableElement.METADATA_PROPERTY); ObjectNode metadataNode = jsonNode.get(IdentifiableElement.METADATA_PROPERTY).deepCopy();
if(metadataNode.isNull()) { if(metadataNode.isNull()) {
return null; return null;
} }
MetadataOrient metadata = new MetadataOrient(); MetadataOrient metadata = new MetadataOrient();
metadataNode.set(OrientDBUtility.ORIENTDB_CLASS_PROPERTY, metadataNode.get(Element.CLASS_PROPERTY));
metadataNode.remove(Element.CLASS_PROPERTY);
metadata.fromJSON(metadataNode.toString()); metadata.fromJSON(metadataNode.toString());
return metadata; return metadata;
} }
@ -73,7 +77,7 @@ public class MetadataUtility {
} else { } else {
try { try {
MetadataOrient metadataOrient = new MetadataOrient(); MetadataOrient metadataOrient = new MetadataOrient();
String json = oDocument.toJSON(); String json = OrientDBUtility.toJsonString(oDocument);
Metadata metadata = ElementMapper.unmarshal(Metadata.class, json); Metadata metadata = ElementMapper.unmarshal(Metadata.class, json);
metadataOrient.setCreatedBy(metadata.getCreatedBy()); metadataOrient.setCreatedBy(metadata.getCreatedBy());
metadataOrient.setCreationTime(metadata.getCreationTime()); metadataOrient.setCreationTime(metadata.getCreationTime());
@ -82,7 +86,7 @@ public class MetadataUtility {
return metadataOrient; return metadataOrient;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Unable to recreate Metadata. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); "Unable to recreate Metadata. " + OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
} }
} }
} }
@ -94,7 +98,7 @@ public class MetadataUtility {
} }
public static Metadata getMetadata(OElement element) throws ResourceRegistryException { public static Metadata getMetadata(OElement element) throws ResourceRegistryException {
return Utility.getPropertyDocument(Metadata.class, element, IdentifiableElement.METADATA_PROPERTY); return OrientDBUtility.getPropertyDocument(Metadata.class, element, IdentifiableElement.METADATA_PROPERTY);
} }
public static void updateModifiedByAndLastUpdate(OElement element) throws ResourceRegistryException { public static void updateModifiedByAndLastUpdate(OElement element) throws ResourceRegistryException {

View File

@ -5,6 +5,8 @@ import java.util.UUID;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Entity;
@ -25,43 +27,64 @@ import com.orientechnologies.orient.core.record.OElement;
import com.orientechnologies.orient.core.record.ORecord; import com.orientechnologies.orient.core.record.ORecord;
import com.orientechnologies.orient.core.record.OVertex; import com.orientechnologies.orient.core.record.OVertex;
import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.record.impl.ODocumentHelper;
import com.orientechnologies.orient.core.sql.executor.OResult; import com.orientechnologies.orient.core.sql.executor.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultSet; import com.orientechnologies.orient.core.sql.executor.OResultSet;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class Utility { public class OrientDBUtility {
private static final Logger logger = LoggerFactory.getLogger(Utility.class); private static final Logger logger = LoggerFactory.getLogger(OrientDBUtility.class);
public static final String ORIENTDB_CLASS_PROPERTY = ODocumentHelper.ATTRIBUTE_CLASS;
public static final String SHOULD_NOT_OCCUR_ERROR_MESSAGE = "This is really strange and should not occur. Please contact the system administrator."; public static final String SHOULD_NOT_OCCUR_ERROR_MESSAGE = "This is really strange and should not occur. Please contact the system administrator.";
public static JsonNode toJsonNode(OElement element, boolean raw) throws ResourceRegistryException { public static JsonNode toJsonNode(OElement element) throws ResourceRegistryException {
ORecord oRecord = element.getRecord(); ORecord oRecord = element.getRecord();
return Utility.toJsonNode(oRecord, raw); return OrientDBUtility.toJsonNode(oRecord);
} }
public static JsonNode toJsonNode(ORecord oRecord, boolean raw) throws ResourceRegistryException { public static JsonNode toJsonNode(ORecord oRecord) throws ResourceRegistryException {
try { try {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readTree(toJsonString(oRecord, raw)); String string = toJsonString(oRecord);
ObjectNode objectNode = (ObjectNode) objectMapper.readTree(string);
return objectNode;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException(e); throw new ResourceRegistryException(e);
} }
} }
public static String toJsonString(OElement element, boolean raw) { public static String replaceType(String s) {
ORecord oRecord = element.getRecord(); s = s.replace("\"" + ORIENTDB_CLASS_PROPERTY + "\"", "\"" + Element.CLASS_PROPERTY + "\"");
return Utility.toJsonString(oRecord, raw); return s;
} }
public static String toJsonString(OResult oResult) {
String ret = oResult.toJSON();
// The above method set the type in @class property
// We want to use the property set in Element.CLASS_PROPERTY
ret = replaceType(ret);
return ret;
}
public static String toJsonString(ORecord oRecord, boolean raw) { public static String toJsonString(ORecord oRecord) {
if(raw) { String ret = oRecord.toJSON("class");
return oRecord.toJSON(); // The above method set the type in @class property
} // We want to use the property set in Element.CLASS_PROPERTY
return oRecord.toJSON("class"); ret = replaceType(ret);
return ret;
}
public static String getAsStringForLogging(ORecord oRecord) {
return oRecord.toJSON();
}
public static String getAsStringForException(ORecord oRecord) {
return toJsonString(oRecord);
} }
public static <El extends OElement> El getElementByUUIDAsAdmin(String elementType, UUID uuid, public static <El extends OElement> El getElementByUUIDAsAdmin(String elementType, UUID uuid,
@ -72,7 +95,7 @@ public class Utility {
current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal(); current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
adminDatabaseDocument = adminSecurityContext.getDatabaseDocument(PermissionMode.READER); adminDatabaseDocument = adminSecurityContext.getDatabaseDocument(PermissionMode.READER);
return Utility.getElementByUUID(adminDatabaseDocument, elementType, uuid, clz); return OrientDBUtility.getElementByUUID(adminDatabaseDocument, elementType, uuid, clz);
} finally { } finally {
if(adminDatabaseDocument != null) { if(adminDatabaseDocument != null) {
adminDatabaseDocument.close(); adminDatabaseDocument.close();
@ -111,7 +134,7 @@ public class Utility {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
El element = (El) ElementManagementUtility.getElementFromOptional(oResult.getElement()); El element = (El) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", elementType, uuid.toString(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", elementType, uuid.toString(), OrientDBUtility.getAsStringForLogging(element));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + elementType + " with uuid " + uuid.toString() throw new ResourceRegistryException("Found more than one " + elementType + " with uuid " + uuid.toString()
@ -125,10 +148,10 @@ public class Utility {
throws ResourceRegistryException { throws ResourceRegistryException {
try { try {
ODocument oDocument = element.getProperty(property); ODocument oDocument = element.getProperty(property);
P e = ElementMapper.unmarshal(clz, oDocument.toJSON()); P e = ElementMapper.unmarshal(clz, OrientDBUtility.toJsonString(oDocument));
return e; return e;
} catch(Exception ex) { } catch(Exception ex) {
String error = String.format("Error while getting %s from %s", property, toJsonString(element, true)); String error = String.format("Error while getting %s from %s", property, getAsStringForException(element));
throw new ResourceRegistryException(error, ex); throw new ResourceRegistryException(error, ex);
} }
} }

View File

@ -69,4 +69,11 @@ public class PropagationConstraintOrient extends ODocument implements org.gcube.
} }
@Override
public String toJSON(String iFormat) {
String ret = super.toJSON(iFormat);
ret = OrientDBUtility.replaceType(ret);
return ret;
}
} }

View File

@ -127,7 +127,7 @@ public class ERManagementTest extends ContextTest {
Configuration configuration = new ConfigurationImpl(); Configuration configuration = new ConfigurationImpl();
IdentifierFacet identifierFacet = new IdentifierFacetImpl(); IdentifierFacet identifierFacet = new IdentifierFacetImpl();
identifierFacet.setType(IdentificationType.STRING); identifierFacet.setIdentificationType(IdentificationType.STRING);
identifierFacet.setValue("MyID"); identifierFacet.setValue("MyID");
identifierFacet.setPersistent(false); identifierFacet.setPersistent(false);
@ -567,9 +567,9 @@ public class ERManagementTest extends ContextTest {
authorization.setSchema(uri); authorization.setSchema(uri);
accessPointFacet.setAuthorization(authorization); accessPointFacet.setAuthorization(authorization);
String additionlaPropertyKey = "Test"; String additionalPropertyKey = "Test";
String additionlaPropertyValue = "MyTest"; String additionlaPropertyValue = "MyTest";
accessPointFacet.setAdditionalProperty(additionlaPropertyKey, additionlaPropertyValue); accessPointFacet.setAdditionalProperty(additionalPropertyKey, additionlaPropertyValue);
Encrypted encrypted = new EncryptedImpl(); Encrypted encrypted = new EncryptedImpl();
String plainValue = "Encrypted"; String plainValue = "Encrypted";
@ -594,7 +594,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(encValue.compareTo(encryptedValue) == 0); Assert.assertTrue(encValue.compareTo(encryptedValue) == 0);
String decryptedValue = StringEncrypter.getEncrypter().decrypt(encValue); String decryptedValue = StringEncrypter.getEncrypter().decrypt(encValue);
Assert.assertTrue(decryptedValue.compareTo(plainValue) == 0); Assert.assertTrue(decryptedValue.compareTo(plainValue) == 0);
Assert.assertTrue(((String) apf.getAdditionalProperty(additionlaPropertyKey)).compareTo(additionlaPropertyValue) == 0); Assert.assertTrue(((String) apf.getAdditionalProperty(additionalPropertyKey)).compareTo(additionlaPropertyValue) == 0);
deleteResource(createdConfiguration); deleteResource(createdConfiguration);
} }
@ -618,7 +618,8 @@ public class ERManagementTest extends ContextTest {
SoftwareFacet softwareFacet = updatedEService.getFacets(SoftwareFacet.class).get(0); SoftwareFacet softwareFacet = updatedEService.getFacets(SoftwareFacet.class).get(0);
Assert.assertTrue(softwareFacet.getVersion().compareTo(newVersion) == 0); Assert.assertTrue(softwareFacet.getVersion().compareTo(newVersion) == 0);
} catch (Throwable e) {
throw e;
}finally { }finally {
deleteResource(eService); deleteResource(eService);
} }

View File

@ -3,6 +3,7 @@ package org.gcube.informationsystem.resourceregistry.instances;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
@ -41,8 +42,8 @@ public class InvalidOperationTest extends ERManagementTest {
private static Logger logger = LoggerFactory.getLogger(InvalidOperationTest.class); private static Logger logger = LoggerFactory.getLogger(InvalidOperationTest.class);
public static final String ACTIVATES = "{\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"@class\":\"Activates\",\"source\":{\"@class\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"@class\":\"EService\"}}"; public static final String ACTIVATES = "{\"propagationConstraint\":{\"" + Element.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"" + Element.CLASS_PROPERTY + "\":\"Activates\",\"source\":{\"" + Element.CLASS_PROPERTY + "\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"" + Element.CLASS_PROPERTY + "\":\"EService\"}}";
public static final String ACTOR = "{\"@class\":\"Actor\",\"metadata\":null,\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"@class\":\"Actor\",\"metadata\":null},\"target\":{\"@class\":\"ContactFacet\",\"metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}"; public static final String ACTOR = "{\"" + Element.CLASS_PROPERTY + "\":\"Actor\",\"metadata\":null,\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"propagationConstraint\":{\"" + Element.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"" + Element.CLASS_PROPERTY + "\":\"Actor\",\"metadata\":null},\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"ContactFacet\",\"metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}";
@Test(expected = SchemaViolationException.class) @Test(expected = SchemaViolationException.class)
public void createInvalidIsRealtedTo() throws Exception { public void createInvalidIsRealtedTo() throws Exception {

View File

@ -96,7 +96,7 @@ public class AddToContextTest extends MultiContextTest {
IdentifierFacet identifierFacet = new IdentifierFacetImpl(); IdentifierFacet identifierFacet = new IdentifierFacetImpl();
identifierFacet.setValue(id); identifierFacet.setValue(id);
identifierFacet.setType(IdentificationType.STRING); identifierFacet.setIdentificationType(IdentificationType.STRING);
identifierFacet.setPersistent(false); identifierFacet.setPersistent(false);
IsIdentifiedBy<Dataset, IdentifierFacet> isIdentifiedBy = new IsIdentifiedByImpl<>(dataset, identifierFacet); IsIdentifiedBy<Dataset, IdentifierFacet> isIdentifiedBy = new IsIdentifiedByImpl<>(dataset, identifierFacet);
dataset.addFacet(isIdentifiedBy); dataset.addFacet(isIdentifiedBy);

View File

@ -20,7 +20,6 @@ import org.gcube.informationsystem.resourceregistry.instances.base.ElementManage
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.utils.TypeUtility; import org.gcube.informationsystem.utils.TypeUtility;
import org.gcube.resourcemanagement.model.impl.entities.facets.IdentifierFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.IdentifierFacetImpl;
@ -318,7 +317,7 @@ public class QueryTest extends ERManagementTest {
IdentifierFacet identifierFacet = new IdentifierFacetImpl(); IdentifierFacet identifierFacet = new IdentifierFacetImpl();
identifierFacet.setValue(name); identifierFacet.setValue(name);
identifierFacet.setType(IdentificationType.STRING); identifierFacet.setIdentificationType(IdentificationType.STRING);
if(value!=null) { if(value!=null) {
identifierFacet.setAdditionalProperty(EXTRA, value); identifierFacet.setAdditionalProperty(EXTRA, value);
} }

View File

@ -1,38 +1,38 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "down" "value": "down"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "data-transfer-service", "name": "data-transfer-service",
"group": "DataTransfer" "group": "DataTransfer"
} }
}, },
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "AccessPointFacet", "type": "AccessPointFacet",
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
} }
} }
], ],
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"@class": "activates", "type": "activates",
"source": { "source": {
"@class": "HostingNode" "type": "HostingNode"
} }
} }
] ]
@ -76,7 +76,7 @@ SELECT FROM (
) )
) )
// WHERE @class="EService" // WHERE type="EService"
@ -111,7 +111,7 @@ SELECT FROM (
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" ) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
) )
) )
) WHERE @class="EService" ) WHERE type="EService"
@ -131,7 +131,7 @@ SELECT FROM (
) )
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" ) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
) )
) WHERE @class="EService" ) WHERE type="EService"
// Generated from code: // Generated from code:
@ -163,7 +163,7 @@ SELECT FROM (
) )
// This is validated by the code to get polymorphic result // This is validated by the code to get polymorphic result
// WHERE @class="EService" // WHERE type="EService"
MATCH MATCH

View File

@ -14,7 +14,7 @@
<logger name="org.gcube.informationsystem.types" level="INFO" /> <logger name="org.gcube.informationsystem.types" level="INFO" />
<logger name="org.gcube.informationsystem.resourceregistry.dbinitialization" level="INFO" /> <logger name="org.gcube.informationsystem.resourceregistry.dbinitialization" level="INFO" />
<logger name="org.gcube.informationsystem.utils.discovery" level="ERROR" /> <logger name="org.gcube.informationsystem.utils.discovery" level="ERROR" />
<logger name="org.gcube.informationsystem.resourceregistry.types" level="INFO" /> <logger name="org.gcube.informationsystem.resourceregistry.types" level="TRACE" />
<logger name="org.gcube.informationsystem.resourceregistry.instances" level="TRACE" /> <logger name="org.gcube.informationsystem.resourceregistry.instances" level="TRACE" />
<root level="WARN"> <root level="WARN">

View File

@ -1,20 +1,20 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "down" "value": "down"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "data-transfer-service", "name": "data-transfer-service",
"group": "DataTransfer" "group": "DataTransfer"
} }

View File

@ -1,38 +1,38 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "down" "value": "down"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "data-transfer-service", "name": "data-transfer-service",
"group": "DataTransfer" "group": "DataTransfer"
} }
}, },
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "AccessPointFacet", "type": "AccessPointFacet",
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
} }
} }
], ],
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"@class": "Activates", "type": "Activates",
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce", "uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
"source": { "source": {
"@class": "HostingNode", "type": "HostingNode",
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717" "uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717"
} }
} }

View File

@ -1,42 +1,42 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "down" "value": "down"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "data-transfer-service", "name": "data-transfer-service",
"group": "DataTransfer" "group": "DataTransfer"
} }
}, },
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "AccessPointFacet", "type": "AccessPointFacet",
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
} }
} }
], ],
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"@class": "Activates", "type": "Activates",
"source": { "source": {
"@class": "HostingNode", "type": "HostingNode",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "CPUFacet", "type": "CPUFacet",
"vendor": "GenuineIntel" "vendor": "GenuineIntel"
} }
} }

View File

@ -1,10 +1,10 @@
{ {
"@class": "StateFacet", "type": "StateFacet",
"value": "down", "value": "down",
"_in": { "_in": {
"@class": "ConsistsOf", "type": "ConsistsOf",
"source" : { "source" : {
"@class" : "EService", "type" : "EService",
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db" "uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db"
} }
} }

View File

@ -1,10 +1,10 @@
{ {
"@class": "StateFacet", "type": "StateFacet",
"value": "down", "value": "down",
"_in": { "_in": {
"@class": "ConsistsOf", "type": "ConsistsOf",
"source" : { "source" : {
"@class" : "EService", "type" : "EService",
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",

View File

@ -1,45 +1,45 @@
{ {
"@class": "EService", "type": "EService",
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db", "uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "down" "value": "down"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "data-transfer-service", "name": "data-transfer-service",
"group": "DataTransfer" "group": "DataTransfer"
} }
}, },
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "AccessPointFacet", "type": "AccessPointFacet",
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service" "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
} }
} }
], ],
"isRelatedTo" : [ "isRelatedTo" : [
{ {
"@class": "Activates", "type": "Activates",
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce", "uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
"source": { "source": {
"@class": "HostingNode", "type": "HostingNode",
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717", "uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"target": { "target": {
"@class": "CPUFacet", "type": "CPUFacet",
"vendor": "GenuineIntel" "vendor": "GenuineIntel"
} }
} }

View File

@ -1,9 +1,9 @@
{ {
"@class": "StateFacet", "type": "StateFacet",
"_in": { "_in": {
"@class": "ConsistsOf", "type": "ConsistsOf",
"source" : { "source" : {
"@class" : "EService", "type" : "EService",
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",

View File

@ -1,12 +1,12 @@
{ {
"@class": "CallsFor", "type": "CallsFor",
"source": { "source": {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"group": "org.gcube.data-catalogue", "group": "org.gcube.data-catalogue",
"name": "gcat" "name": "gcat"
} }
@ -14,12 +14,12 @@
] ]
}, },
"target":{ "target":{
"@class": "VirtualService", "type": "VirtualService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"group": "org.gcube.data-catalogue", "group": "org.gcube.data-catalogue",
"name": "catalogue-virtual-service" "name": "catalogue-virtual-service"
} }

View File

@ -1,28 +1,28 @@
{ {
"@class": "SimpleFacet", "type": "SimpleFacet",
"_in": { "_in": {
"@class": "ConsistsOf", "type": "ConsistsOf",
"source": { "source": {
"@class": "Configuration", "type": "Configuration",
"consistsOf": [ "consistsOf": [
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "IdentifierFacet", "type": "IdentifierFacet",
"value": "gcat-configuration" "value": "gcat-configuration"
} }
} }
], ],
"isRelatedTo": [ "isRelatedTo": [
{ {
"@class": "IsCustomizedBy", "type": "IsCustomizedBy",
"source": { "source": {
"@class": "VirtualService", "type": "VirtualService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"group": "org.gcube.data-catalogue", "group": "org.gcube.data-catalogue",
"name": "catalogue-virtual-service" "name": "catalogue-virtual-service"
} }

View File

@ -1,20 +1,20 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "$state" "value": "$state"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"group": "$group", "group": "$group",
"name": "$name" "name": "$name"
} }

View File

@ -1,20 +1,20 @@
{ {
"@class": "EService", "type": "EService",
"consistsOf": [ "consistsOf": [
{ {
"@class": "ConsistsOf", "type": "ConsistsOf",
"propagationConstraint" : { "propagationConstraint" : {
"add": "propagate" "add": "propagate"
}, },
"target": { "target": {
"@class": "StateFacet", "type": "StateFacet",
"value": "$state" "value": "$state"
} }
}, },
{ {
"@class": "IsIdentifiedBy", "type": "IsIdentifiedBy",
"target": { "target": {
"@class": "SoftwareFacet", "type": "SoftwareFacet",
"name": "$name", "name": "$name",
"group": "$group" "group": "$group"
} }