Changed '@class' to 'type'
This commit is contained in:
parent
39556110c2
commit
ff68eb6f28
|
@ -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.PermissionMode;
|
||||
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.Utility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class ContextUtility {
|
|||
ODatabaseDocument oDatabaseDocument = null;
|
||||
try {
|
||||
oDatabaseDocument = getAdminSecurityContext().getDatabaseDocument(PermissionMode.READER);
|
||||
OVertex oVertex = Utility.getElementByUUID(oDatabaseDocument, Context.NAME, uuid,
|
||||
OVertex oVertex = OrientDBUtility.getElementByUUID(oDatabaseDocument, Context.NAME, uuid,
|
||||
OVertex.class);
|
||||
return oVertex;
|
||||
} finally {
|
||||
|
@ -235,7 +235,7 @@ public class ContextUtility {
|
|||
OResult oResult = resultSet.next();
|
||||
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()) {
|
||||
throw new ContextNotFoundException("Found more than one context with name " + name
|
||||
|
|
|
@ -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.queries.operators.QueryConditionalOperator;
|
||||
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.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.utils.UUIDManager;
|
||||
|
@ -193,7 +193,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
|||
((ObjectNode) context).replace(Context.PARENT_PROPERTY, isParentOf);
|
||||
}
|
||||
} 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("");
|
||||
}
|
||||
}
|
||||
|
@ -207,10 +207,10 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
|||
JsonNode isParentOf = isParentOfManagement.serializeAsJsonNode();
|
||||
context = addRelation(context, isParentOf, Context.CHILDREN_PROPERTY);
|
||||
} 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;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
|||
for (OVertex p : iterable) {
|
||||
if (found) {
|
||||
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());
|
||||
}
|
||||
parent = p;
|
||||
|
@ -370,7 +370,7 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
|
|||
|
||||
if (edgeIterator.hasNext()) {
|
||||
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);
|
||||
} catch (ResourceRegistryException e) {
|
||||
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 {
|
||||
|
|
|
@ -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.SecurityContext;
|
||||
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 com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
@ -88,10 +88,10 @@ public class IsParentOfManagement extends RelationElementManagement<ContextManag
|
|||
}
|
||||
|
||||
} 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;
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.contexts.ContextUtility;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -165,7 +165,7 @@ public class SecurityContext {
|
|||
errorMessage.append(" to non hierarchic ");
|
||||
errorMessage.append(SecurityContext.class.getSimpleName());
|
||||
errorMessage.append(". ");
|
||||
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
final String error = errorMessage.toString();
|
||||
logger.error(error);
|
||||
throw new RuntimeException(error);
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.gcube.informationsystem.resourceregistry.types.TypesCache;
|
|||
import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility;
|
||||
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.entities.ResourceType;
|
||||
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) {
|
||||
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);
|
||||
} catch(NotFoundException e) {
|
||||
throw getSpecificNotFoundException(e);
|
||||
|
@ -560,7 +560,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
|
||||
public El retrieveElementFromAnyContext() throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
return Utility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid,
|
||||
return OrientDBUtility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid,
|
||||
elementClass);
|
||||
} catch(NotFoundException 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) {
|
||||
// Keeping the metadata
|
||||
MetadataOrient metadataOrient = MetadataUtility.getMetadataOrient((ODocument) object);
|
||||
JsonNode metadataJson = Utility.toJsonNode(metadataOrient, false);
|
||||
JsonNode metadataJson = OrientDBUtility.toJsonNode(metadataOrient);
|
||||
if(ContextUtility.getIncludeInstanceContexts().get()) {
|
||||
((ObjectNode) metadataJson).set(Metadata.__CONTEXTS, getContextsAsObjectNode());
|
||||
}
|
||||
|
|
|
@ -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.RelationManagement;
|
||||
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.LoggerFactory;
|
||||
|
||||
|
@ -81,9 +81,9 @@ public class ElementManagementUtility {
|
|||
|
||||
public static OElement getAnyElementByUUID(UUID uuid) throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, OVertex.class);
|
||||
return OrientDBUtility.getElementByUUIDAsAdmin(null, uuid, OVertex.class);
|
||||
} catch(NotFoundException e) {
|
||||
return Utility.getElementByUUIDAsAdmin(null, uuid, OEdge.class);
|
||||
return OrientDBUtility.getElementByUUIDAsAdmin(null, uuid, OEdge.class);
|
||||
} catch(ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch(Exception e) {
|
||||
|
@ -94,9 +94,9 @@ public class ElementManagementUtility {
|
|||
public static OElement getAnyElementByUUID(ODatabaseDocument oDatabaseDocument, UUID uuid)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
return Utility.getElementByUUID(oDatabaseDocument, null, uuid, OVertex.class);
|
||||
return OrientDBUtility.getElementByUUID(oDatabaseDocument, null, uuid, OVertex.class);
|
||||
} catch(NotFoundException e) {
|
||||
return Utility.getElementByUUID(oDatabaseDocument, null, uuid, OEdge.class);
|
||||
return OrientDBUtility.getElementByUUID(oDatabaseDocument, null, uuid, OEdge.class);
|
||||
} catch(ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch(Exception e) {
|
||||
|
@ -121,12 +121,12 @@ public class ElementManagementUtility {
|
|||
|
||||
if(oDatabaseDocument == null) {
|
||||
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) {
|
||||
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;
|
||||
|
@ -134,7 +134,7 @@ public class ElementManagementUtility {
|
|||
oClass = ElementManagementUtility.getOClass(vertex);
|
||||
} catch(Exception e) {
|
||||
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);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class ElementManagementUtility {
|
|||
entityManagement = new FacetManagement();
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
entityManagement.setODatabaseDocument(oDatabaseDocument);
|
||||
|
@ -160,12 +160,12 @@ public class ElementManagementUtility {
|
|||
|
||||
if(oDatabaseDocument == null) {
|
||||
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) {
|
||||
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);
|
||||
|
@ -177,7 +177,7 @@ public class ElementManagementUtility {
|
|||
relationManagement = new IsRelatedToManagement();
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.ElementManagementUtility;
|
||||
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 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(elem.getClass().getSimpleName());
|
||||
errorMessage.append(". ");
|
||||
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
throw new ResourceRegistryException(errorMessage.toString());
|
||||
}
|
||||
relationManagements.put(id, baseRelationManagement);
|
||||
|
@ -156,7 +156,7 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
|
|||
}
|
||||
|
||||
logger.info("Created {} is {}", OVertex.class.getSimpleName(),
|
||||
Utility.toJsonString(element, true));
|
||||
OrientDBUtility.getAsStringForLogging(element));
|
||||
|
||||
return element;
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.gcube.informationsystem.resourceregistry.types.CachedType;
|
|||
import org.gcube.informationsystem.resourceregistry.types.TypesCache;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient;
|
||||
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.types.reference.properties.PropertyType;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
|
@ -139,7 +140,7 @@ public class PropertyElementManagement {
|
|||
public static JsonNode getJsonNode(ODocument oDocument) throws ResourceRegistryException {
|
||||
try {
|
||||
String type = oDocument.getClassName();
|
||||
String json = oDocument.toJSON("class");
|
||||
String json = OrientDBUtility.toJsonString(oDocument);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode jsonNode = objectMapper.readTree(json);
|
||||
|
|
|
@ -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.instances.base.ElementManagement;
|
||||
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.relations.RelationType;
|
||||
import org.gcube.informationsystem.utils.UUIDUtility;
|
||||
|
@ -123,10 +123,10 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
|
|||
}
|
||||
|
||||
} 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;
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
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.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException;
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
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.rest.SharingPath.SharingOperation;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
|
|
|
@ -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.types.TypesCache;
|
||||
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 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(elem.getClass().getSimpleName());
|
||||
errorMessage.append(". ");
|
||||
errorMessage.append(Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
errorMessage.append(OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
throw new ResourceRegistryException(errorMessage.toString());
|
||||
}
|
||||
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(),
|
||||
Utility.toJsonString((OVertex) element, true));
|
||||
OrientDBUtility.getAsStringForLogging((OVertex) element));
|
||||
|
||||
return element;
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
@ -505,7 +505,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
arrayNode.add(jsonNode);
|
||||
} catch(ResourceRegistryException e) {
|
||||
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 {
|
||||
|
@ -694,7 +694,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
arrayNode.add(node);
|
||||
} catch(ResourceRegistryException e) {
|
||||
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
|
||||
* 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 ");
|
||||
|
@ -753,7 +753,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
selectStringBuilder.append(" ))");
|
||||
|
||||
if(!polymorphic) {
|
||||
selectStringBuilder.append(" WHERE @class='");
|
||||
selectStringBuilder.append(" WHERE type='");
|
||||
selectStringBuilder.append(typeName);
|
||||
selectStringBuilder.append("'");
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
oClass = ElementManagementUtility.getOClass(element);
|
||||
} catch(Exception e) {
|
||||
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);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
arrayNode.add(jsonNode);
|
||||
} catch(ResourceRegistryException e) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.types.CachedType;
|
||||
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.properties.LinkedEntity;
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
|
|||
errorMessage.append("SourceEntityManagement for ");
|
||||
errorMessage.append(relationManagement.getClass().getSimpleName());
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -114,10 +114,10 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
|
|||
JsonNode consistsOf = relationManagement.serializeAsJsonNode();
|
||||
sourceResource = addConsistsOf(sourceResource, consistsOf);
|
||||
} 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;
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
@ -234,8 +234,8 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
|
|||
} else if(oClass.isSubClassOf(ConsistsOf.NAME)) {
|
||||
relationManagement = new ConsistsOfManagement();
|
||||
} else {
|
||||
logger.warn("{} is not a {} nor a {}. {}", Utility.toJsonString(edge, true), IsRelatedTo.NAME,
|
||||
ConsistsOf.NAME, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.warn("{} is not a {} nor a {}. {}", OrientDBUtility.getAsStringForLogging(edge), IsRelatedTo.NAME,
|
||||
ConsistsOf.NAME, OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
}
|
||||
if(relationManagement != null) {
|
||||
relationManagement.setWorkingContext(getWorkingContext());
|
||||
|
|
|
@ -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.instances.base.entities.EntityElementManagement;
|
||||
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.ResourceType;
|
||||
|
||||
|
@ -88,10 +88,10 @@ public class IsRelatedToManagement extends RelationManagement<ResourceManagement
|
|||
}
|
||||
|
||||
} 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;
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.utils.MetadataUtility;
|
||||
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.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
|
@ -219,7 +219,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
} else {
|
||||
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
||||
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
} else {
|
||||
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
||||
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
|
||||
|
@ -253,10 +253,10 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
propagationConstraint = (PropagationConstraint) oDocument;
|
||||
} else {
|
||||
try {
|
||||
propagationConstraint = ElementMapper.unmarshal(PropagationConstraint.class, oDocument.toJSON());
|
||||
propagationConstraint = ElementMapper.unmarshal(PropagationConstraint.class, OrientDBUtility.toJsonString(oDocument));
|
||||
} catch(Exception e) {
|
||||
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;
|
||||
|
||||
try {
|
||||
propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY);
|
||||
if(propagationConstraint.getAddConstraint() != null) {
|
||||
addConstraint = propagationConstraint.getAddConstraint();
|
||||
} else {
|
||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
|
||||
PropagationConstraint.ADD_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
PropagationConstraint.ADD_PROPERTY, OrientDBUtility.getAsStringForException(element),
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.error(error);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
String error = String.format("Error while getting %s from %s while performing AddToContext. %s",
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY, OrientDBUtility.getAsStringForException(element),
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.warn(error);
|
||||
throw new ResourceRegistryException(error, e);
|
||||
}
|
||||
|
@ -561,21 +561,21 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
RemoveConstraint removeConstraint = RemoveConstraint.keep;
|
||||
|
||||
try {
|
||||
propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class, element,
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY);
|
||||
if(propagationConstraint.getRemoveConstraint() != null) {
|
||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||
} else {
|
||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
|
||||
PropagationConstraint.REMOVE_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
PropagationConstraint.REMOVE_PROPERTY, OrientDBUtility.getAsStringForException(element),
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.error(error);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
String error = String.format("Error while getting %s from %s while performing RemoveFromContext. %s",
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
Relation.PROPAGATION_CONSTRAINT_PROPERTY, OrientDBUtility.getAsStringForException(element),
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
logger.error(error);
|
||||
throw new ResourceRegistryException(error, e);
|
||||
|
||||
|
@ -722,29 +722,22 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
DeleteConstraint deleteConstraint = DeleteConstraint.keep;
|
||||
|
||||
try {
|
||||
PropagationConstraint propagationConstraint = Utility.getPropertyDocument(PropagationConstraint.class,
|
||||
PropagationConstraint propagationConstraint = OrientDBUtility.getPropertyDocument(PropagationConstraint.class,
|
||||
element, Relation.PROPAGATION_CONSTRAINT_PROPERTY);
|
||||
if(propagationConstraint.getDeleteConstraint() != null) {
|
||||
deleteConstraint = propagationConstraint.getDeleteConstraint();
|
||||
} else {
|
||||
String error = String.format("%s.%s in %s is null. %s", Relation.PROPAGATION_CONSTRAINT_PROPERTY,
|
||||
PropagationConstraint.DELETE_PROPERTY, Utility.toJsonString(element, true),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
PropagationConstraint.DELETE_PROPERTY, OrientDBUtility.getAsStringForException(element),
|
||||
OrientDBUtility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
|
||||
logger.warn(error);
|
||||
// logger.error(error);
|
||||
// TODO Added for backward compatibility
|
||||
deleteConstraint = DeleteConstraint.values()[propagationConstraint.getRemoveConstraint().ordinal()];
|
||||
/*
|
||||
* TODO Restore the exception raising and remove the line above
|
||||
*
|
||||
* throw new ResourceRegistryException(error);
|
||||
*/
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
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
|
||||
|
|
|
@ -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.instances.base.ElementManagement;
|
||||
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.LoggerFactory;
|
||||
|
||||
|
@ -52,10 +52,10 @@ public class QueryImpl implements Query {
|
|||
if(raw) {
|
||||
if(oResult.isElement()) {
|
||||
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
|
||||
jsonNode = Utility.toJsonNode(element, false);
|
||||
jsonNode = OrientDBUtility.toJsonNode(element);
|
||||
}else {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
jsonNode = mapper.readTree(oResult.toJSON());
|
||||
jsonNode = mapper.readTree(OrientDBUtility.toJsonString(oResult));
|
||||
}
|
||||
} else {
|
||||
OElement element = ElementManagementUtility.getElementFromOptional(oResult.getElement());
|
||||
|
@ -67,7 +67,7 @@ public class QueryImpl implements Query {
|
|||
|
||||
} catch(ResourceRegistryException e) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.types.CachedType;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -136,7 +136,7 @@ public class JsonQuery {
|
|||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||
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 gotType = erManagement.getTypeName();
|
||||
|
@ -157,7 +157,7 @@ public class JsonQuery {
|
|||
|
||||
} catch(ResourceRegistryException e) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class JsonQueryFacet extends JsonQueryEntity {
|
|||
newBuffer.append(")");
|
||||
}
|
||||
|
||||
// Size 1 means that only '@class' property is present
|
||||
// Size 1 means that only 'type' property is present
|
||||
if(size > 1) {
|
||||
newBuffer.append(" WHERE ");
|
||||
newBuffer.append(addConstraints(jsonNode, null, null));
|
||||
|
|
|
@ -79,7 +79,7 @@ public class JsonQueryConsistsOf extends JsonQueryRelation {
|
|||
consistsOfBuffer.append(stringBuffer);
|
||||
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) {
|
||||
consistsOfBuffer.append(") WHERE "); // Close ) SELECT
|
||||
consistsOfBuffer.append(addConstraints(jsonNode, null, null));
|
||||
|
|
|
@ -33,7 +33,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
|
|||
|
||||
int size = jsonNode.size();
|
||||
|
||||
// Remove @class from size
|
||||
// Remove type from size
|
||||
--size;
|
||||
|
||||
if(jsonNode.has(IsRelatedTo.SOURCE_PROPERTY)) {
|
||||
|
@ -72,7 +72,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
|
|||
|
||||
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(!entryPoint) {
|
||||
stringBuffer.append(" )"); // Close ) SELECT
|
||||
|
|
|
@ -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.entities.EntityElementManagement;
|
||||
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.types.reference.entities.EntityType;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -185,7 +185,7 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
|
|||
OResult oResult = resultSet.next();
|
||||
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()) {
|
||||
resultSet.close();
|
||||
|
@ -264,7 +264,7 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
|
|||
arrayNode.add(jsonObject);
|
||||
} catch (ResourceRegistryException e) {
|
||||
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 {
|
||||
|
|
|
@ -258,30 +258,30 @@ public class Access extends BaseRest {
|
|||
* Content Body example:
|
||||
*
|
||||
* {
|
||||
* "@class": "EService",
|
||||
* "": "EService",
|
||||
* "consistsOf": [
|
||||
* {
|
||||
* "@class": "ConsistsOf",
|
||||
* "": "ConsistsOf",
|
||||
* "propagationConstraint" : {
|
||||
* "add": "propagate"
|
||||
* },
|
||||
* "target": {
|
||||
* "@class": "StateFacet",
|
||||
* "": "StateFacet",
|
||||
* "value": "down"
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "@class": "IsIdentifiedBy",
|
||||
* "": "IsIdentifiedBy",
|
||||
* "target": {
|
||||
* "@class": "SoftwareFacet",
|
||||
* "": "SoftwareFacet",
|
||||
* "name": "data-transfer-service",
|
||||
* "group": "DataTransfer"
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "@class": "ConsistsOf",
|
||||
* "": "ConsistsOf",
|
||||
* "target": {
|
||||
* "@class": "AccessPointFacet",
|
||||
* "": "AccessPointFacet",
|
||||
* "endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
|
||||
* }
|
||||
* }
|
||||
|
|
|
@ -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.
|
||||
* The content of the request to run this query template will be something like {\"$state\": "ready"}",
|
||||
* "template": {
|
||||
* "@class": "EService",
|
||||
* "type": "EService",
|
||||
* "consistsOf": [{
|
||||
* "@class": "ConsistsOf",
|
||||
* "type": "ConsistsOf",
|
||||
* "target": {
|
||||
* "@class": "StateFacet",
|
||||
* "type": "StateFacet",
|
||||
* "value": "$state"
|
||||
* }
|
||||
* }]
|
||||
|
|
|
@ -64,9 +64,9 @@ public class SharingManager {
|
|||
* The the body is the following
|
||||
*
|
||||
* [
|
||||
* {"@class" : "HostingNode", "uuid" : "16032d09-3823-444e-a1ff-a67de4f350a8" },
|
||||
* {"@class" : "Hosts", "uuid" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"},
|
||||
* {"@class" : "EService", "uuid" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"}
|
||||
* {"type" : "HostingNode", "uuid" : "16032d09-3823-444e-a1ff-a67de4f350a8" },
|
||||
* {"type" : "Hosts", "uuid" : "97ab8a6b-6b1b-4868-b8fc-ba48d0439ba9"},
|
||||
* {"type" : "EService", "uuid" : "d3b1a29b-aa70-4a5a-be83-361a4209dd3e"}
|
||||
* ]
|
||||
*
|
||||
*
|
||||
|
|
|
@ -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.instances.base.ElementManagementUtility;
|
||||
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.reference.entities.EntityType;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -139,7 +139,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
|
|||
OResult oResult = resultSet.next();
|
||||
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()) {
|
||||
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);
|
||||
|
||||
logger.debug("Created {} is {}", OVertex.class.getSimpleName(), Utility.toJsonString(element, true));
|
||||
logger.debug("Created {} is {}", OVertex.class.getSimpleName(), OrientDBUtility.getAsStringForLogging(element));
|
||||
|
||||
return element;
|
||||
} catch (ResourceRegistryException e) {
|
||||
|
|
|
@ -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.instances.base.ElementManagement;
|
||||
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.properties.PropertyType;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -146,7 +146,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
|
|||
OResult oResult = resultSet.next();
|
||||
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()) {
|
||||
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);
|
||||
|
||||
logger.debug("Created {} is {}", PropertyType.NAME, Utility.toJsonString(element, true));
|
||||
logger.debug("Created {} is {}", PropertyType.NAME, OrientDBUtility.getAsStringForLogging(element));
|
||||
|
||||
return element;
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
|
|
@ -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.types.entities.EntityTypeDefinitionManagement;
|
||||
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.ResourceType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
|
@ -176,7 +176,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
OResult oResult = resultSet.next();
|
||||
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()) {
|
||||
throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
|
||||
|
|
|
@ -37,10 +37,11 @@ public class EncryptedOrient extends ODocument {
|
|||
|
||||
@Override
|
||||
public String toJSON(String iFormat) {
|
||||
return super.toJSON(iFormat);
|
||||
String ret = super.toJSON(iFormat);
|
||||
ret = OrientDBUtility.replaceType(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public String getDecryptedValue() {
|
||||
return decryptedValue;
|
||||
}
|
||||
|
|
|
@ -78,4 +78,11 @@ public class MetadataOrient extends ODocument implements Metadata {
|
|||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJSON(String iFormat) {
|
||||
String ret = super.toJSON(iFormat);
|
||||
ret = OrientDBUtility.replaceType(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ import java.util.Date;
|
|||
import org.gcube.com.fasterxml.jackson.core.JsonParseException;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
|
||||
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.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.Metadata;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
|
@ -56,11 +58,13 @@ public class MetadataUtility {
|
|||
public static Metadata getMetadata(JsonNode jsonNode)
|
||||
throws JsonParseException, JsonMappingException, IOException, ResourceRegistryException {
|
||||
if(jsonNode.has(IdentifiableElement.METADATA_PROPERTY)) {
|
||||
JsonNode metadataNode = jsonNode.get(IdentifiableElement.METADATA_PROPERTY);
|
||||
ObjectNode metadataNode = jsonNode.get(IdentifiableElement.METADATA_PROPERTY).deepCopy();
|
||||
if(metadataNode.isNull()) {
|
||||
return null;
|
||||
}
|
||||
MetadataOrient metadata = new MetadataOrient();
|
||||
metadataNode.set(OrientDBUtility.ORIENTDB_CLASS_PROPERTY, metadataNode.get(Element.CLASS_PROPERTY));
|
||||
metadataNode.remove(Element.CLASS_PROPERTY);
|
||||
metadata.fromJSON(metadataNode.toString());
|
||||
return metadata;
|
||||
}
|
||||
|
@ -73,7 +77,7 @@ public class MetadataUtility {
|
|||
} else {
|
||||
try {
|
||||
MetadataOrient metadataOrient = new MetadataOrient();
|
||||
String json = oDocument.toJSON();
|
||||
String json = OrientDBUtility.toJsonString(oDocument);
|
||||
Metadata metadata = ElementMapper.unmarshal(Metadata.class, json);
|
||||
metadataOrient.setCreatedBy(metadata.getCreatedBy());
|
||||
metadataOrient.setCreationTime(metadata.getCreationTime());
|
||||
|
@ -82,7 +86,7 @@ public class MetadataUtility {
|
|||
return metadataOrient;
|
||||
} catch(Exception e) {
|
||||
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 {
|
||||
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 {
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.util.UUID;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
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.properties.PropertyElement;
|
||||
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.OVertex;
|
||||
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.OResultSet;
|
||||
|
||||
/**
|
||||
* @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 JsonNode toJsonNode(OElement element, boolean raw) throws ResourceRegistryException {
|
||||
public static JsonNode toJsonNode(OElement element) throws ResourceRegistryException {
|
||||
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 {
|
||||
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) {
|
||||
throw new ResourceRegistryException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String toJsonString(OElement element, boolean raw) {
|
||||
ORecord oRecord = element.getRecord();
|
||||
return Utility.toJsonString(oRecord, raw);
|
||||
public static String replaceType(String s) {
|
||||
s = s.replace("\"" + ORIENTDB_CLASS_PROPERTY + "\"", "\"" + Element.CLASS_PROPERTY + "\"");
|
||||
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) {
|
||||
if(raw) {
|
||||
return oRecord.toJSON();
|
||||
}
|
||||
return oRecord.toJSON("class");
|
||||
public static String toJsonString(ORecord oRecord) {
|
||||
String ret = oRecord.toJSON("class");
|
||||
// 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 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,
|
||||
|
@ -72,7 +95,7 @@ public class Utility {
|
|||
current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
|
||||
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
|
||||
adminDatabaseDocument = adminSecurityContext.getDatabaseDocument(PermissionMode.READER);
|
||||
return Utility.getElementByUUID(adminDatabaseDocument, elementType, uuid, clz);
|
||||
return OrientDBUtility.getElementByUUID(adminDatabaseDocument, elementType, uuid, clz);
|
||||
} finally {
|
||||
if(adminDatabaseDocument != null) {
|
||||
adminDatabaseDocument.close();
|
||||
|
@ -111,7 +134,7 @@ public class Utility {
|
|||
@SuppressWarnings("unchecked")
|
||||
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()) {
|
||||
throw new ResourceRegistryException("Found more than one " + elementType + " with uuid " + uuid.toString()
|
||||
|
@ -125,10 +148,10 @@ public class Utility {
|
|||
throws ResourceRegistryException {
|
||||
try {
|
||||
ODocument oDocument = element.getProperty(property);
|
||||
P e = ElementMapper.unmarshal(clz, oDocument.toJSON());
|
||||
P e = ElementMapper.unmarshal(clz, OrientDBUtility.toJsonString(oDocument));
|
||||
return e;
|
||||
} 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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ERManagementTest extends ContextTest {
|
|||
Configuration configuration = new ConfigurationImpl();
|
||||
|
||||
IdentifierFacet identifierFacet = new IdentifierFacetImpl();
|
||||
identifierFacet.setType(IdentificationType.STRING);
|
||||
identifierFacet.setIdentificationType(IdentificationType.STRING);
|
||||
identifierFacet.setValue("MyID");
|
||||
identifierFacet.setPersistent(false);
|
||||
|
||||
|
@ -567,9 +567,9 @@ public class ERManagementTest extends ContextTest {
|
|||
authorization.setSchema(uri);
|
||||
accessPointFacet.setAuthorization(authorization);
|
||||
|
||||
String additionlaPropertyKey = "Test";
|
||||
String additionalPropertyKey = "Test";
|
||||
String additionlaPropertyValue = "MyTest";
|
||||
accessPointFacet.setAdditionalProperty(additionlaPropertyKey, additionlaPropertyValue);
|
||||
accessPointFacet.setAdditionalProperty(additionalPropertyKey, additionlaPropertyValue);
|
||||
|
||||
Encrypted encrypted = new EncryptedImpl();
|
||||
String plainValue = "Encrypted";
|
||||
|
@ -594,7 +594,7 @@ public class ERManagementTest extends ContextTest {
|
|||
Assert.assertTrue(encValue.compareTo(encryptedValue) == 0);
|
||||
String decryptedValue = StringEncrypter.getEncrypter().decrypt(encValue);
|
||||
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);
|
||||
}
|
||||
|
@ -618,7 +618,8 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
SoftwareFacet softwareFacet = updatedEService.getFacets(SoftwareFacet.class).get(0);
|
||||
Assert.assertTrue(softwareFacet.getVersion().compareTo(newVersion) == 0);
|
||||
|
||||
} catch (Throwable e) {
|
||||
throw e;
|
||||
}finally {
|
||||
deleteResource(eService);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.resourceregistry.instances;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
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);
|
||||
|
||||
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 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 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 = "{\"" + 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)
|
||||
public void createInvalidIsRealtedTo() throws Exception {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class AddToContextTest extends MultiContextTest {
|
|||
|
||||
IdentifierFacet identifierFacet = new IdentifierFacetImpl();
|
||||
identifierFacet.setValue(id);
|
||||
identifierFacet.setType(IdentificationType.STRING);
|
||||
identifierFacet.setIdentificationType(IdentificationType.STRING);
|
||||
identifierFacet.setPersistent(false);
|
||||
IsIdentifiedBy<Dataset, IdentifierFacet> isIdentifiedBy = new IsIdentifiedByImpl<>(dataset, identifierFacet);
|
||||
dataset.addFacet(isIdentifiedBy);
|
||||
|
|
|
@ -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.relations.ConsistsOfManagement;
|
||||
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.utils.TypeUtility;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.IdentifierFacetImpl;
|
||||
|
@ -318,7 +317,7 @@ public class QueryTest extends ERManagementTest {
|
|||
|
||||
IdentifierFacet identifierFacet = new IdentifierFacetImpl();
|
||||
identifierFacet.setValue(name);
|
||||
identifierFacet.setType(IdentificationType.STRING);
|
||||
identifierFacet.setIdentificationType(IdentificationType.STRING);
|
||||
if(value!=null) {
|
||||
identifierFacet.setAdditionalProperty(EXTRA, value);
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
{
|
||||
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "data-transfer-service",
|
||||
"group": "DataTransfer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "AccessPointFacet",
|
||||
"type": "AccessPointFacet",
|
||||
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
|
||||
}
|
||||
}
|
||||
],
|
||||
"isRelatedTo" : [
|
||||
{
|
||||
"@class": "activates",
|
||||
"type": "activates",
|
||||
"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 @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 @class="EService"
|
||||
) WHERE type="EService"
|
||||
|
||||
|
||||
// Generated from code:
|
||||
|
@ -163,7 +163,7 @@ SELECT FROM (
|
|||
)
|
||||
|
||||
// This is validated by the code to get polymorphic result
|
||||
// WHERE @class="EService"
|
||||
// WHERE type="EService"
|
||||
|
||||
|
||||
MATCH
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<logger name="org.gcube.informationsystem.types" 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.resourceregistry.types" level="INFO" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.types" level="TRACE" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.instances" level="TRACE" />
|
||||
|
||||
<root level="WARN">
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "data-transfer-service",
|
||||
"group": "DataTransfer"
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "data-transfer-service",
|
||||
"group": "DataTransfer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "AccessPointFacet",
|
||||
"type": "AccessPointFacet",
|
||||
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
|
||||
}
|
||||
}
|
||||
],
|
||||
"isRelatedTo" : [
|
||||
{
|
||||
"@class": "Activates",
|
||||
"type": "Activates",
|
||||
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
|
||||
"source": {
|
||||
"@class": "HostingNode",
|
||||
"type": "HostingNode",
|
||||
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "data-transfer-service",
|
||||
"group": "DataTransfer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "AccessPointFacet",
|
||||
"type": "AccessPointFacet",
|
||||
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
|
||||
}
|
||||
}
|
||||
],
|
||||
"isRelatedTo" : [
|
||||
{
|
||||
"@class": "Activates",
|
||||
"type": "Activates",
|
||||
"source": {
|
||||
"@class": "HostingNode",
|
||||
"type": "HostingNode",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "CPUFacet",
|
||||
"type": "CPUFacet",
|
||||
"vendor": "GenuineIntel"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down",
|
||||
"_in": {
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"source" : {
|
||||
"@class" : "EService",
|
||||
"type" : "EService",
|
||||
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down",
|
||||
"_in": {
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"source" : {
|
||||
"@class" : "EService",
|
||||
"type" : "EService",
|
||||
"$or": [
|
||||
{"$and": {
|
||||
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"uuid": "0255b7ec-e3da-4071-b456-9a2907ece1db",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "down"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "data-transfer-service",
|
||||
"group": "DataTransfer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "AccessPointFacet",
|
||||
"type": "AccessPointFacet",
|
||||
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
|
||||
}
|
||||
}
|
||||
],
|
||||
"isRelatedTo" : [
|
||||
{
|
||||
"@class": "Activates",
|
||||
"type": "Activates",
|
||||
"uuid": "d3f58e52-5346-47bc-b736-9d77a0b554ce",
|
||||
"source": {
|
||||
"@class": "HostingNode",
|
||||
"type": "HostingNode",
|
||||
"uuid" : "5fbc1a56-d450-4f0f-85c1-9b1684581717",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"target": {
|
||||
"@class": "CPUFacet",
|
||||
"type": "CPUFacet",
|
||||
"vendor": "GenuineIntel"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"_in": {
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"source" : {
|
||||
"@class" : "EService",
|
||||
"type" : "EService",
|
||||
"$or": [
|
||||
{"$and": {
|
||||
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"@class": "CallsFor",
|
||||
"type": "CallsFor",
|
||||
"source": {
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"group": "org.gcube.data-catalogue",
|
||||
"name": "gcat"
|
||||
}
|
||||
|
@ -14,12 +14,12 @@
|
|||
]
|
||||
},
|
||||
"target":{
|
||||
"@class": "VirtualService",
|
||||
"type": "VirtualService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"group": "org.gcube.data-catalogue",
|
||||
"name": "catalogue-virtual-service"
|
||||
}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
{
|
||||
"@class": "SimpleFacet",
|
||||
"type": "SimpleFacet",
|
||||
"_in": {
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"source": {
|
||||
"@class": "Configuration",
|
||||
"type": "Configuration",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "IdentifierFacet",
|
||||
"type": "IdentifierFacet",
|
||||
"value": "gcat-configuration"
|
||||
}
|
||||
}
|
||||
],
|
||||
"isRelatedTo": [
|
||||
{
|
||||
"@class": "IsCustomizedBy",
|
||||
"type": "IsCustomizedBy",
|
||||
"source": {
|
||||
"@class": "VirtualService",
|
||||
"type": "VirtualService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"group": "org.gcube.data-catalogue",
|
||||
"name": "catalogue-virtual-service"
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "$state"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"group": "$group",
|
||||
"name": "$name"
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"@class": "EService",
|
||||
"type": "EService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "ConsistsOf",
|
||||
"type": "ConsistsOf",
|
||||
"propagationConstraint" : {
|
||||
"add": "propagate"
|
||||
},
|
||||
"target": {
|
||||
"@class": "StateFacet",
|
||||
"type": "StateFacet",
|
||||
"value": "$state"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"type": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"type": "SoftwareFacet",
|
||||
"name": "$name",
|
||||
"group": "$group"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue