uuid property has been renamed to id

This commit is contained in:
Luca Frosini 2023-04-28 11:33:29 +02:00
parent a79ed8fd56
commit 86f015cb21
18 changed files with 43 additions and 42 deletions

View File

@ -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;
}

View File

@ -36,12 +36,12 @@ public abstract class RelationElementImpl<S extends EntityElement, T extends Ent
}
@Override
public UUID getUUID() {
public UUID getID() {
return uuid;
}
@Override
public void setUUID(UUID uuid) {
public void setID(UUID uuid) {
this.uuid = uuid;
}

View File

@ -12,17 +12,17 @@ import org.gcube.informationsystem.model.reference.properties.Metadata;
*
* @author Luca Frosini (ISTI - CNR)
*/
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
public interface IdentifiableElement extends Element {
public static final String UUID_PROPERTY = "uuid";
public static final String ID_PROPERTY = "id";
public static final String METADATA_PROPERTY = "metadata";
@JsonGetter(value = UUID_PROPERTY)
public UUID getUUID();
@JsonGetter(value = ID_PROPERTY)
public UUID getID();
@JsonSetter(value = UUID_PROPERTY)
public void setUUID(UUID uuid);
@JsonSetter(value = ID_PROPERTY)
public void setID(UUID uuid);
@JsonGetter(value = METADATA_PROPERTY)
public Metadata getMetadata();

View File

@ -18,7 +18,7 @@ import org.gcube.informationsystem.utils.Version;
*/
@Abstract
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
//@JsonDeserialize(as=EntityElementImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = EntityElement.NAME, description = "This is the base type for any EntityElement", version = Version.MINIMAL_VERSION_STRING)
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
@ -26,12 +26,12 @@ public interface EntityElement extends Element, IdentifiableElement {
public static final String NAME = "EntityElement"; //Entity.class.getSimpleName();
@ISProperty(name = UUID_PROPERTY, description = "This UUID is be used to identify the instance univocally.", readonly = true, mandatory = true, nullable = false)
@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();
@Override
public void setUUID(UUID uuid);
public void setID(UUID uuid);
@ISProperty(name=METADATA_PROPERTY, mandatory=true, nullable=false, description="Metadata associated with the instance that is automatically created/updated by the system.")
@Override

View File

@ -28,12 +28,12 @@ public interface RelationElement<S extends EntityElement, T extends EntityElemen
public static final String SOURCE_PROPERTY = "source";
public static final String TARGET_PROPERTY = "target";
@ISProperty(name = UUID_PROPERTY, description = "This UUID is be used to identify the instance univocally.", readonly = true, mandatory = true, nullable = false)
@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();
@Override
public void setUUID(UUID uuid);
public void setID(UUID uuid);
@ISProperty(name=METADATA_PROPERTY, mandatory=true, nullable=false, description="Metadata associated with the instance that is automatically created/updated by the system.")
@Override

View File

@ -62,12 +62,12 @@ public final class ContextImpl extends EntityElementImpl implements Context {
* @return the uuid
*/
@Override
public UUID getUUID() {
public UUID getID() {
return uuid;
}
@Override
public void setUUID(UUID uuid) {
public void setID(UUID uuid) {
this.uuid = uuid;
}

View File

@ -178,10 +178,10 @@ public abstract class ResourceImpl extends EntityImpl implements Resource {
}
if (relation.getSource().getMetadata()!= null &&
relation.getSource().getUUID() != null &&
relation.getSource().getID() != null &&
this.metadata !=null &&
this.uuid != null &&
relation.getSource().getUUID().compareTo(this.uuid)!=0) {
relation.getSource().getID().compareTo(this.uuid)!=0) {
throw new RuntimeException(message);
}

View File

@ -19,7 +19,7 @@ import org.gcube.informationsystem.utils.Version;
* @author Luca Frosini (ISTI - CNR)
*/
@Abstract
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
//@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = Entity.NAME, description = "This is the base type for any Entity", version = Version.MINIMAL_VERSION_STRING)
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)

View File

@ -21,7 +21,7 @@ import org.gcube.informationsystem.utils.Version;
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Facet
*/
@Abstract
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY })
// @JsonDeserialize(as=FacetImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = "Facet", description = "This is the base type for any Facet", version = Version.MINIMAL_VERSION_STRING)

View File

@ -28,7 +28,7 @@ import org.gcube.informationsystem.utils.Version;
*/
@Abstract
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY, Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY, Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY })
// @JsonDeserialize(as=ResourceImpl.class) Do not uncomment to manage subclasses
@ResourceSchema(
facets={

View File

@ -35,7 +35,7 @@ import org.gcube.informationsystem.utils.Version;
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Relation
*/
@Abstract
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.UUID_PROPERTY, IdentifiableElement.METADATA_PROPERTY, Relation.PROPAGATION_CONSTRAINT_PROPERTY })
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY, Relation.PROPAGATION_CONSTRAINT_PROPERTY })
// @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = Relation.NAME, description = "This is the base type for any Relation", version = Version.MINIMAL_VERSION_STRING)
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)

View File

@ -192,12 +192,12 @@ public class TypeImpl implements Type {
}
@Override
public UUID getUUID() {
public UUID getID() {
return uuid;
}
@Override
public void setUUID(UUID uuid) {
public void setID(UUID uuid) {
this.uuid = uuid;
}

View File

@ -37,13 +37,13 @@ public interface Type extends IdentifiableElement {
public static final String TYPE_SUPER_TYPES_PROPERTY = "typeSuperTypes";
public static final String PROPERTIES_PROPERTY = "properties";
@JsonGetter(value = UUID_PROPERTY)
@JsonGetter(value = ID_PROPERTY)
@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)
@Override

View File

@ -29,14 +29,14 @@ public interface PropertyType<P extends PropertyElement> 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.")

View File

@ -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;
}

View File

@ -72,7 +72,7 @@ public class MetadataTest {
@SuppressWarnings("unchecked")
Map<String,String> contexts = (Map<String, String>) h.getAdditionalProperty(Metadata.__CONTEXTS);
logger.debug("Contexts UUIDs are {}", contexts);
logger.debug("Contexts IDs are {}", contexts);
}
}

View File

@ -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 + "," +

View File

@ -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<Metadata> metadataType = (PropertyType<Metadata>) TypeMapper.deserializeTypeDefinition(json);