From 79c0c9a0ab387b81d7e3e728883b1427cbea98ce Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 18 Apr 2023 17:52:07 +0200 Subject: [PATCH] Redesigning E/R instance definition --- pom.xml | 2 +- .../contexts/ContextUtility.java | 6 +- .../contexts/entities/ContextManagement.java | 6 +- .../contexts/security/SecurityContext.java | 2 +- .../dbinitialization/DatabaseEnvironment.java | 14 +- .../instances/base/ElementManagement.java | 54 +++---- .../entities/EntityElementManagement.java | 2 +- .../properties/PropertyElementManagement.java | 91 ++++-------- .../relations/RelationElementManagement.java | 1 - .../model/entities/EntityManagement.java | 15 +- .../model/relations/RelationManagement.java | 6 +- .../json/base/entities/JsonQueryResource.java | 2 +- .../resourceregistry/rest/SharingManager.java | 6 +- .../types/TypeManagement.java | 2 +- .../resourceregistry/utils/HeaderUtility.java | 137 ------------------ ...{HeaderOrient.java => MetadataOrient.java} | 37 ++--- .../utils/MetadataUtility.java | 109 ++++++++++++++ .../resourceregistry/utils/Utility.java | 45 ++++-- .../resourceregistry/utils/VaultOrient.java | 96 ------------ .../contexts/ContextManagementTest.java | 4 +- .../instances/ERManagementTest.java | 6 +- .../tobereviewed/FacetManagementTest.java | 4 +- 22 files changed, 239 insertions(+), 408 deletions(-) delete mode 100644 src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java rename src/main/java/org/gcube/informationsystem/resourceregistry/utils/{HeaderOrient.java => MetadataOrient.java} (56%) create mode 100644 src/main/java/org/gcube/informationsystem/resourceregistry/utils/MetadataUtility.java delete mode 100644 src/main/java/org/gcube/informationsystem/resourceregistry/utils/VaultOrient.java diff --git a/pom.xml b/pom.xml index 9b51cad..047b2e6 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ org.gcube.distribution gcube-smartgears-bom - 2.3.0 + 2.5.0-SNAPSHOT pom import diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextUtility.java index 8d00939..c0cb33a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextUtility.java @@ -10,7 +10,6 @@ import org.gcube.common.scope.impl.ScopeBean; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.contexts.reference.entities.Context; import org.gcube.informationsystem.contexts.reference.relations.IsParentOf; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException; @@ -27,7 +26,6 @@ import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal; import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.record.ODirection; import com.orientechnologies.orient.core.record.OVertex; -import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.executor.OResult; import com.orientechnologies.orient.core.sql.executor.OResultSet; @@ -125,9 +123,7 @@ public class ContextUtility { OVertex contextVertex = getContextVertexByFullName(oDatabaseDocument, fullName); - ODocument oDocument = contextVertex.getProperty(IdentifiableElement.HEADER_PROPERTY); - - uuid = UUID.fromString(oDocument.getProperty(Header.UUID_PROPERTY)); + uuid = UUID.fromString(contextVertex.getProperty(IdentifiableElement.UUID_PROPERTY)); securityContext = getSecurityContextByUUID(uuid, contextVertex); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/entities/ContextManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/entities/ContextManagement.java index 4b6edc5..7268f78 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/entities/ContextManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/entities/ContextManagement.java @@ -12,9 +12,9 @@ import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; import org.gcube.com.fasterxml.jackson.databind.node.NullNode; import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.contexts.reference.entities.Context; import org.gcube.informationsystem.contexts.reference.relations.IsParentOf; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; @@ -127,9 +127,7 @@ public class ContextManagement extends EntityElementManagement> definitionToBeCreated = new ArrayList<>(); definitionToBeCreated.add(PropertyElement.class); definitionToBeCreated.add(Property.class); - definitionToBeCreated.add(Header.class); + definitionToBeCreated.add(Metadata.class); definitionToBeCreated.add(PropertyDefinition.class); definitionToBeCreated.add(PropertyType.class); definitionToBeCreated.add(LinkedEntity.class); @@ -215,7 +215,7 @@ public class DatabaseEnvironment { TypeManagement typeManagement = new TypeManagement(); typeManagement.setTypeAndTypeName(clz); - if(clz.equals(Property.class) || clz.equals(Header.class) ) { + if(clz.equals(Property.class) || clz.equals(Metadata.class) ) { ((TypeManagement) typeManagement).setSkipTypeDefinitionCreation(true); } @@ -231,17 +231,17 @@ public class DatabaseEnvironment { } /* - * We have already created Property and Header - * because Header is needed to create + * We have already created Property and Metadata + * because Metadata is needed to create * types for internal use (i.e. Context, EntityType). * - * For Property and Header we also need + * For Property and Metadata we also need * to create the instance in TypeSecurityContext * as we will do for any other Property specialization. */ List> schemaToBeCreated = new ArrayList<>(); schemaToBeCreated.add(Property.class); - schemaToBeCreated.add(Header.class); + schemaToBeCreated.add(Metadata.class); for(Class clazz : schemaToBeCreated) { ElementManagement erManagement = new PropertyTypeDefinitionManagement(); erManagement.setJson(TypeMapper.serializeType(clazz)); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java index fd0be28..424d34c 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java @@ -28,7 +28,7 @@ import org.gcube.common.authorization.library.provider.CalledMethodProvider; import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.IdentifiableElement; -import org.gcube.informationsystem.model.reference.properties.Header; +import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; @@ -46,8 +46,8 @@ import org.gcube.informationsystem.resourceregistry.instances.base.properties.Pr import org.gcube.informationsystem.resourceregistry.instances.model.Operation; import org.gcube.informationsystem.resourceregistry.types.CachedType; import org.gcube.informationsystem.resourceregistry.types.TypesCache; -import org.gcube.informationsystem.resourceregistry.utils.HeaderOrient; -import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.MetadataOrient; +import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.entities.ResourceType; @@ -136,7 +136,7 @@ public abstract class ElementManagement { this.accessType = accessType; this.ignoreKeys = new HashSet(); - + this.ignoreStartWithKeys = new HashSet(); this.ignoreStartWithKeys.add(ElementManagement.AT); @@ -350,15 +350,8 @@ public abstract class ElementManagement { } protected void checkUUIDMatch() throws ResourceRegistryException { - Header header = null; - try { - header = HeaderUtility.getHeader(jsonNode, false); - } catch(Exception e) { - throw new ResourceRegistryException(e); - } - - if(header != null) { - UUID resourceUUID = header.getUUID(); + if(jsonNode.has(IdentifiableElement.UUID_PROPERTY)) { + UUID resourceUUID = UUID.fromString(jsonNode.get(IdentifiableElement.UUID_PROPERTY).asText()); if(resourceUUID.compareTo(uuid) != 0) { String error = String.format( "UUID provided in header (%s) differs from the one (%s) used to identify the %s instance", @@ -440,14 +433,15 @@ public abstract class ElementManagement { reallyCreate(); - Header entityHeader = HeaderUtility.getHeader(jsonNode, true); - if(entityHeader != null) { - element.setProperty(IdentifiableElement.HEADER_PROPERTY, entityHeader); + Metadata entityMetadata = MetadataUtility.getMetadata(jsonNode); + if(entityMetadata != null) { + element.setProperty(IdentifiableElement.METADATA_PROPERTY, entityMetadata); } else { - entityHeader = HeaderUtility.addHeader(element, null); - uuid = entityHeader.getUUID(); + entityMetadata = MetadataUtility.addMetadata(element); } + this.uuid = Utility.getUUID(element, true); + getWorkingContext().addElement(element, oDatabaseDocument); element.save(); @@ -470,7 +464,7 @@ public abstract class ElementManagement { reallyUpdate(); - HeaderUtility.updateModifiedByAndLastUpdate(element); + MetadataUtility.updateModifiedByAndLastUpdate(element); element.save(); @@ -505,7 +499,7 @@ public abstract class ElementManagement { throw new ResourceRegistryException("Trying to set null " + elementClass.getSimpleName() + " in " + this); } this.element = element; - this.uuid = HeaderUtility.getHeader(element).getUUID(); + this.uuid = Utility.getUUID(element); OClass oClass = getOClass(); this.typeName = oClass.getName(); } @@ -1078,8 +1072,8 @@ public abstract class ElementManagement { for(String key : properties.keySet()) { try { - if(key.compareTo(IdentifiableElement.HEADER_PROPERTY)==0) { - // We never update the header with the value provided + if(key.compareTo(IdentifiableElement.METADATA_PROPERTY)==0) { + // We never update the metadata with the value provided continue; } @@ -1145,23 +1139,23 @@ public abstract class ElementManagement { return (JsonNode) object; } - if(key.compareTo(IdentifiableElement.HEADER_PROPERTY) == 0) { - // Keeping the header - HeaderOrient headerOrient = HeaderUtility.getHeaderOrient((ODocument) object); - JsonNode headerJson = Utility.toJsonNode(headerOrient, false); + if(key.compareTo(IdentifiableElement.METADATA_PROPERTY) == 0) { + // Keeping the metadata + MetadataOrient metadataOrient = MetadataUtility.getMetadataOrient((ODocument) object); + JsonNode metadataJson = Utility.toJsonNode(metadataOrient, false); if(ContextUtility.getIncludeInstanceContexts().get()) { - ((ObjectNode) headerJson).set(Header.__CONTEXTS, getContextsAsObjectNode()); + ((ObjectNode) metadataJson).set(Metadata.__CONTEXTS, getContextsAsObjectNode()); } TypesCache typesCache = TypesCache.getInstance(); @SuppressWarnings("unchecked") - CachedType> headerType = (CachedType>) typesCache.getCachedType(Header.NAME); + CachedType> headerType = (CachedType>) typesCache.getCachedType(Metadata.NAME); ObjectMapper objectMapper = new ObjectMapper(); Collection superClasses = headerType.getSuperTypes(); ArrayNode arrayNode = objectMapper.valueToTree(superClasses); - ((ObjectNode) headerJson).replace(Element.SUPERCLASSES_PROPERTY, arrayNode); + ((ObjectNode) metadataJson).replace(Element.SUPERCLASSES_PROPERTY, arrayNode); - return headerJson; + return metadataJson; } if(ignoreKeys.contains(key)) { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/entities/EntityElementManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/entities/EntityElementManagement.java index 8acf9f0..f21996e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/entities/EntityElementManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/entities/EntityElementManagement.java @@ -43,7 +43,7 @@ public abstract class EntityElementManagement sourceEntityClass, Class targetEntityClass) { super(accessType); - this.ignoreKeys.add(Relation.HEADER_PROPERTY); this.ignoreKeys.add(Relation.SOURCE_PROPERTY); this.ignoreKeys.add(Relation.TARGET_PROPERTY); this.ignoreKeys.add(IN.toLowerCase()); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java index 533d7a0..1fc95d1 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java @@ -18,7 +18,6 @@ import org.gcube.informationsystem.contexts.reference.entities.Context; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; @@ -40,7 +39,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.ERManagement 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.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.types.reference.entities.EntityType; @@ -147,8 +146,6 @@ public abstract class EntityManagement protected EntityManagement(AccessType accessType) { super(accessType); - this.ignoreKeys.add(Entity.HEADER_PROPERTY); - this.ignoreStartWithKeys.add(IN_PREFIX.toLowerCase()); this.ignoreStartWithKeys.add(OUT_PREFIX.toLowerCase()); this.ignoreStartWithKeys.add(IN_PREFIX.toUpperCase()); @@ -338,7 +335,7 @@ public abstract class EntityManagement setOperation(Operation.ADD_TO_CONTEXT); reallyAddToContext(); if(!skipped) { - HeaderUtility.updateModifiedByAndLastUpdate(element); + MetadataUtility.updateModifiedByAndLastUpdate(element); element.save(); affectedInstances.put(uuid, serializeAsAffectedInstance()); sanityCheck(); @@ -402,7 +399,7 @@ public abstract class EntityManagement try { setOperation(Operation.REMOVE_FROM_CONTEXT); reallyRemoveFromContext(); - HeaderUtility.updateModifiedByAndLastUpdate(element); + MetadataUtility.updateModifiedByAndLastUpdate(element); element.save(); affectedInstances.put(uuid, serializeAsAffectedInstance()); sanityCheck(); @@ -716,7 +713,7 @@ public abstract class EntityManagement ArrayNode arrayNode = objectMapper.createArrayNode(); if(referenceUUID != null) { - constraint.put(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY, referenceUUID.toString()); + constraint.put(Entity.UUID_PROPERTY, referenceUUID.toString()); } // TODO check types @@ -795,8 +792,8 @@ public abstract class EntityManagement EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(), oDatabaseDocument, vertex); try { - if(constraint.containsKey(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY)) { - String uuid = constraint.get(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY); + if(constraint.containsKey(Entity.UUID_PROPERTY)) { + String uuid = constraint.get(Entity.UUID_PROPERTY); if(entityManagement.getUUID().compareTo(UUID.fromString(uuid)) == 0) { continue; } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/relations/RelationManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/relations/RelationManagement.java index 3e26b64..61c85a2 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/relations/RelationManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/relations/RelationManagement.java @@ -40,7 +40,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Ent import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.types.TypesCache; -import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +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.serialization.ElementMapper; @@ -473,7 +473,7 @@ public abstract class RelationManagement()); @@ -135,14 +135,37 @@ public class Utility { } } - public static UUID getUUID(OElement element) throws ResourceRegistryException { - /* - * ODocument header = element.getProperty(Entity.HEADER_PROPERTY); String - * contextID = header.field(Header.UUID_PROPERTY); return - * UUID.fromString(contextID); - */ - Header header = HeaderUtility.getHeader(element); - return header.getUUID(); + public static UUID getUUID(JsonNode jsonNode) throws ResourceRegistryException { + if(jsonNode.has(IdentifiableElement.UUID_PROPERTY)) { + String uuidString = jsonNode.get(IdentifiableElement.UUID_PROPERTY).asText(); + return getUUID(uuidString, false); + } + return null; + } + + public static UUID getUUID(OElement element) throws ResourceRegistryException { + return getUUID(element, false); + } + + public static UUID getUUID(OElement element, boolean create) throws ResourceRegistryException { + String uuidString = element.getProperty(IdentifiableElement.UUID_PROPERTY); + return getUUID(uuidString, create); + } + + public static UUID getUUID(String uuidString, boolean create) throws ResourceRegistryException { + UUIDManager uuidManager = UUIDManager.getInstance(); + UUID uuid = null; + if(uuidString == null) { + if(create) { + uuid = uuidManager.generateValidRandomUUID(); + } + }else { + if(!uuidManager.isReservedUUID(uuidString)) { + uuid = UUID.fromString(uuidString); + }else { + uuid = uuidManager.generateValidRandomUUID(); + } + } + return uuid; } - } \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/VaultOrient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/VaultOrient.java deleted file mode 100644 index e58e656..0000000 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/VaultOrient.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.gcube.informationsystem.resourceregistry.utils; - -import java.security.Key; -import java.util.Map; - -import org.gcube.common.encryption.encrypter.StringEncrypter; -import org.gcube.informationsystem.model.reference.properties.Vault; -import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; - -import com.orientechnologies.orient.core.record.impl.ODocument; - -/** - * @author Luca Frosini (ISTI - CNR) - */ -public class VaultOrient extends ODocument implements org.gcube.informationsystem.model.reference.properties.Vault { - - protected String decryptedValue; - protected String dbEncryptedValue; - protected String contextEncryptedValue; - - public VaultOrient() { - super(Vault.NAME); - } - - protected VaultOrient(String iClassName) { - super(iClassName); - } - - @Override - public String getValue() { - return this.field(Vault.VALUE); - } - - @Override - public void setValue(String value) { - this.field(Vault.VALUE, value); - } - - @Override - public String toJSON(String iFormat) { - return super.toJSON(iFormat); - } - - - public String getDecryptedValue() { - return decryptedValue; - } - - public String getDbEncryptedValue() { - return dbEncryptedValue; - } - - public String getContextEncryptedValue() { - return contextEncryptedValue; - } - - public void setDecryptedValue(String decryptedValue, boolean setEncryptedForContext) throws Exception { - this.decryptedValue = decryptedValue; - - // Encrypting with DB Key - Key databaseKey = DatabaseEnvironment.getDatabaseKey(); - this.dbEncryptedValue = StringEncrypter.getEncrypter().encrypt(decryptedValue, databaseKey); - - // Encrypting with Context Key (default key) - this.contextEncryptedValue = StringEncrypter.getEncrypter().encrypt(decryptedValue); - - - if(setEncryptedForContext) { - setValue(contextEncryptedValue); - }else { - setValue(dbEncryptedValue); - } - - } - - @Override - public Map getAdditionalProperties() { - return null; - } - - @Override - public void setAdditionalProperties(Map additionalProperties) { - - } - - @Override - public Object getAdditionalProperty(String key) { - return null; - } - - @Override - public void setAdditionalProperty(String key, Object value) { - - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/contexts/ContextManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/contexts/ContextManagementTest.java index 395e3d0..ae70741 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/contexts/ContextManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/contexts/ContextManagementTest.java @@ -23,7 +23,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.SecurityType; import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; -import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.serialization.ElementMapper; import org.junit.Assert; import org.junit.Test; @@ -54,7 +54,7 @@ public class ContextManagementTest extends ContextTest { Assert.assertTrue(er.getHeader().getUUID().compareTo(uuid) == 0); } - String user = HeaderUtility.getUser(); + String user = MetadataUtility.getUser(); Assert.assertTrue(er.getHeader().getLastUpdateBy().compareTo(user) == 0); if(create) { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/instances/ERManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/instances/ERManagementTest.java index f6fcf0a..ae79b52 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/instances/ERManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/instances/ERManagementTest.java @@ -35,7 +35,7 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Fac 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.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl; @@ -247,13 +247,13 @@ public class ERManagementTest extends ContextTest { if(header.getCreatedBy()!=null) { Assert.assertTrue(createdBy.compareTo(header.getCreatedBy())==0); }else { - Assert.assertTrue(createdBy.compareTo(HeaderUtility.getUser())==0); + Assert.assertTrue(createdBy.compareTo(MetadataUtility.getUser())==0); } if(header.getLastUpdateBy()!=null) { Assert.assertTrue(lastUpdateBy.compareTo(header.getLastUpdateBy())==0); }else { - Assert.assertTrue(lastUpdateBy.compareTo(HeaderUtility.getUser())==0); + Assert.assertTrue(lastUpdateBy.compareTo(MetadataUtility.getUser())==0); } if(header.getLastUpdateTime()!=null) { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/tobereviewed/FacetManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/tobereviewed/FacetManagementTest.java index 0a72483..9e050e4 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/tobereviewed/FacetManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/tobereviewed/FacetManagementTest.java @@ -5,7 +5,7 @@ import java.util.UUID; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.resourceregistry.instances.multicontext.MultiContextTest; -import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.MetadataUtility; import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl; import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet; import org.junit.Assert; @@ -48,7 +48,7 @@ public class FacetManagementTest extends MultiContextTest { Assert.assertTrue(er.getHeader().getUUID().compareTo(uuid) == 0); } - String user = HeaderUtility.getUser(); + String user = MetadataUtility.getUser(); Assert.assertTrue(er.getHeader().getLastUpdateBy().compareTo(user) == 0); if(create) {