From 86f015cb21f3de8dcf8543f2a19c34be19d4db27 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 28 Apr 2023 11:33:29 +0200 Subject: [PATCH] uuid property has been renamed to id --- .../base/impl/entities/EntityElementImpl.java | 4 ++-- .../base/impl/relations/RelationElementImpl.java | 4 ++-- .../base/reference/IdentifiableElement.java | 12 ++++++------ .../base/reference/entities/EntityElement.java | 8 ++++---- .../base/reference/relations/RelationElement.java | 6 +++--- .../contexts/impl/entities/ContextImpl.java | 4 ++-- .../model/impl/entities/ResourceImpl.java | 4 ++-- .../model/reference/entities/Entity.java | 2 +- .../model/reference/entities/Facet.java | 2 +- .../model/reference/entities/Resource.java | 2 +- .../model/reference/relations/Relation.java | 2 +- .../gcube/informationsystem/types/impl/TypeImpl.java | 4 ++-- .../informationsystem/types/reference/Type.java | 8 ++++---- .../types/reference/properties/PropertyType.java | 10 +++++----- .../gcube/informationsystem/utils/UUIDUtility.java | 4 ++-- .../model/impl/properties/MetadataTest.java | 2 +- .../impl/properties/PropagationConstraintTest.java | 4 ++-- .../informationsystem/types/SerializationTest.java | 3 ++- 18 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java index 05fa6a4..fd4a331 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java @@ -28,12 +28,12 @@ public abstract class EntityElementImpl extends ElementImpl implements EntityEle } @Override - public UUID getUUID() { + public UUID getID() { return uuid; } @Override - public void setUUID(UUID uuid) { + public void setID(UUID uuid) { this.uuid = uuid; } diff --git a/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java index c8142f6..33cbff7 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java @@ -36,12 +36,12 @@ public abstract class RelationElementImpl extends PropertyElement public static final String NAME = "PropertyType"; // PropertyType.class.getSimpleName(); - @JsonGetter(value = UUID_PROPERTY) - @ISProperty(name = UUID_PROPERTY, description = "This UUID is be used to identify the instance univocally.", readonly = true, mandatory = true, nullable = false) + @JsonGetter(value = ID_PROPERTY) + @ISProperty(name = ID_PROPERTY, description = "This UUID is be used to identify the instance univocally.", readonly = true, mandatory = true, nullable = false) @Override - public UUID getUUID(); + public UUID getID(); - @JsonSetter(value = UUID_PROPERTY) + @JsonSetter(value = ID_PROPERTY) @Override - public void setUUID(UUID uuid); + public void setID(UUID uuid); @JsonGetter(value = METADATA_PROPERTY) @ISProperty(name=METADATA_PROPERTY, mandatory=true, nullable=false, description="Metadata associated with the instance that is automatically created/updated by the system.") diff --git a/src/main/java/org/gcube/informationsystem/utils/UUIDUtility.java b/src/main/java/org/gcube/informationsystem/utils/UUIDUtility.java index 99576a9..2ae4a79 100644 --- a/src/main/java/org/gcube/informationsystem/utils/UUIDUtility.java +++ b/src/main/java/org/gcube/informationsystem/utils/UUIDUtility.java @@ -17,8 +17,8 @@ public class UUIDUtility { private static Logger logger = LoggerFactory.getLogger(UUIDUtility.class); public static UUID getUUID(JsonNode jsonNode){ - if(jsonNode.has(IdentifiableElement.UUID_PROPERTY)) { - return UUID.fromString(jsonNode.get(IdentifiableElement.UUID_PROPERTY).asText()); + if(jsonNode.has(IdentifiableElement.ID_PROPERTY)) { + return UUID.fromString(jsonNode.get(IdentifiableElement.ID_PROPERTY).asText()); } return null; } diff --git a/src/test/java/org/gcube/informationsystem/model/impl/properties/MetadataTest.java b/src/test/java/org/gcube/informationsystem/model/impl/properties/MetadataTest.java index 8719713..0a7a961 100644 --- a/src/test/java/org/gcube/informationsystem/model/impl/properties/MetadataTest.java +++ b/src/test/java/org/gcube/informationsystem/model/impl/properties/MetadataTest.java @@ -72,7 +72,7 @@ public class MetadataTest { @SuppressWarnings("unchecked") Map contexts = (Map) h.getAdditionalProperty(Metadata.__CONTEXTS); - logger.debug("Contexts UUIDs are {}", contexts); + logger.debug("Contexts IDs are {}", contexts); } } diff --git a/src/test/java/org/gcube/informationsystem/model/impl/properties/PropagationConstraintTest.java b/src/test/java/org/gcube/informationsystem/model/impl/properties/PropagationConstraintTest.java index 59dd62d..1e0f68b 100644 --- a/src/test/java/org/gcube/informationsystem/model/impl/properties/PropagationConstraintTest.java +++ b/src/test/java/org/gcube/informationsystem/model/impl/properties/PropagationConstraintTest.java @@ -130,13 +130,13 @@ public class PropagationConstraintTest { "\"" + ConsistsOf.PROPAGATION_CONSTRAINT_PROPERTY + "\":"+ pcString + "," + "\"" + ConsistsOf.METADATA_PROPERTY + "\": " + hString + "," + "\"" + ConsistsOf.SOURCE_PROPERTY + "\":{" + - "\"" + IdentifiableElement.UUID_PROPERTY + "\":\"4a971915-ca90-48cf-9975-63ee2dd28605\"," + + "\"" + IdentifiableElement.ID_PROPERTY + "\":\"4a971915-ca90-48cf-9975-63ee2dd28605\"," + "\"" + Element.TYPE_PROPERTY + "\":\"MyEService\"," + "\"" + Element.SUPERTYPES_PROPERTY + "\":[\"EService\", \"Service\", \"Resource\"]," + "\"" + ConsistsOf.METADATA_PROPERTY + "\": " + hString + "}," + "\"" + ConsistsOf.TARGET_PROPERTY + "\":{" + - "\"" + IdentifiableElement.UUID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\"," + + "\"" + IdentifiableElement.ID_PROPERTY + "\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\"," + "\"" + Element.TYPE_PROPERTY + "\":\"MySoftwareFacet\"," + "\"" + Element.SUPERTYPES_PROPERTY + "\":[\"SoftwareFacet\", \"Facet\"]," + "\"" + ConsistsOf.METADATA_PROPERTY + "\": " + hString + "," + diff --git a/src/test/java/org/gcube/informationsystem/types/SerializationTest.java b/src/test/java/org/gcube/informationsystem/types/SerializationTest.java index d21f184..90ae588 100644 --- a/src/test/java/org/gcube/informationsystem/types/SerializationTest.java +++ b/src/test/java/org/gcube/informationsystem/types/SerializationTest.java @@ -2,6 +2,7 @@ package org.gcube.informationsystem.types; 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.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.contexts.reference.entities.Context; @@ -207,7 +208,7 @@ public class SerializationTest { logger.debug("Version {}", typeVersion.toString()); logger.info(ElementMapper.marshal(propertyType)); - String json = "{\"" + Element.TYPE_PROPERTY + "\":\"PropertyType\",\"metadata\":null,\"name\":\"Metadata\",\"description\":\"This class provides metadata per every IdentifiableElement\",\"typeSuperTypes\":[\"Property\"],\"properties\":[{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"creationTime\",\"description\":\"Creation time. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateTime\",\"description\":\"Last Update time. At creation time it assumes the same value of creationTime. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"createdBy\",\"description\":\"The user that created the Entity or the Relation. It is initialized at creation time. \",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"uuid\",\"description\":\"This UUID is be used to identify the Entity or the Relation univocally.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":\"^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}){1}$\",\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateBy\",\"description\":\"The user that made the last update to the Entity or the Relation. At creation time, it assumes the same value of creator.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"}],\"accessType\":\"PROPERTY\",\"abstract\":false,\"version\":\"1.0.0\",\"changelog\":{\"1.0.0\":\"First Version\"}}"; + String json = "{\"" + Element.TYPE_PROPERTY + "\":\"PropertyType\",\"metadata\":null,\"name\":\"Metadata\",\"description\":\"This class provides metadata per every IdentifiableElement\",\"typeSuperTypes\":[\"Property\"],\"properties\":[{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"creationTime\",\"description\":\"Creation time. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateTime\",\"description\":\"Last Update time. At creation time it assumes the same value of creationTime. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"createdBy\",\"description\":\"The user that created the Entity or the Relation. It is initialized at creation time. \",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"" + IdentifiableElement.ID_PROPERTY + "\",\"description\":\"This ID is be used to identify the Entity or the Relation univocally.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":\"^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}){1}$\",\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateBy\",\"description\":\"The user that made the last update to the Entity or the Relation. At creation time, it assumes the same value of creator.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"}],\"accessType\":\"PROPERTY\",\"abstract\":false,\"version\":\"1.0.0\",\"changelog\":{\"1.0.0\":\"First Version\"}}"; logger.info(json); @SuppressWarnings("unchecked") PropertyType metadataType = (PropertyType) TypeMapper.deserializeTypeDefinition(json);