From a977dc0faf59fefa578c94584e8b48d03f176a4d Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 20 Apr 2023 11:09:22 +0200 Subject: [PATCH] Redesigning E/R instance definition --- .../types/reference/Type.java | 3 --- .../types/reference/entities/EntityType.java | 26 ++++++++++++++++-- .../reference/properties/PropertyType.java | 27 ++++++++++++++----- .../reference/relations/RelationType.java | 27 +++++++++++++++++-- 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/types/reference/Type.java b/src/main/java/org/gcube/informationsystem/types/reference/Type.java index 61da704..09dab65 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/Type.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/Type.java @@ -12,7 +12,6 @@ import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.types.annotations.Abstract; -import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.utils.Version; @@ -38,7 +37,6 @@ public interface Type extends IdentifiableElement { public static final String PROPERTIES_PROPERTY = "properties"; @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) @Override public UUID getUUID(); @@ -47,7 +45,6 @@ public interface Type extends IdentifiableElement { public void setUUID(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.") @Override public Metadata getMetadata(); diff --git a/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java b/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java index 20431e4..48f9a42 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java @@ -1,10 +1,14 @@ package org.gcube.informationsystem.types.reference.entities; import java.util.Set; +import java.util.UUID; +import org.gcube.com.fasterxml.jackson.annotation.JsonGetter; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.gcube.com.fasterxml.jackson.annotation.JsonSetter; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl; import org.gcube.informationsystem.types.reference.Change; @@ -23,7 +27,25 @@ public interface EntityType extends Type, EntityElement { public static final String NAME = "EntityType"; //EntityType.class.getSimpleName(); - /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + + @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) + @Override + public UUID getUUID(); + + @JsonSetter(value = UUID_PROPERTY) + @Override + public void setUUID(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.") + @Override + public Metadata getMetadata(); + + @JsonSetter(value = METADATA_PROPERTY) + @Override + public void setMetadata(Metadata metadata); @Override @ISProperty(name = Type.NAME_PROPERTY, readonly = true, mandatory = true, nullable = false) @@ -41,6 +63,6 @@ public interface EntityType extends Type, EntityElement { @ISProperty(name = Type.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false) public Set getSuperClasses(); - /* {@link Type} is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java index 32bfe4b..be6b023 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java @@ -1,10 +1,12 @@ package org.gcube.informationsystem.types.reference.properties; import java.util.Set; +import java.util.UUID; +import org.gcube.com.fasterxml.jackson.annotation.JsonGetter; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.gcube.com.fasterxml.jackson.annotation.JsonSetter; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.types.annotations.Final; @@ -25,15 +27,28 @@ import org.gcube.informationsystem.utils.Version; @Final public interface PropertyType

extends PropertyElement, Type { - public static final String NAME = "PropertyType"; // PropertyTypeDefinition.class.getSimpleName(); + public static final String NAME = "PropertyType"; // PropertyType.class.getSimpleName(); - @ISProperty(name=IdentifiableElement.METADATA_PROPERTY, mandatory=true, nullable=false) + /* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + + @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) + @Override + public UUID getUUID(); + + @JsonSetter(value = UUID_PROPERTY) + @Override + public void setUUID(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.") + @Override public Metadata getMetadata(); + @JsonSetter(value = METADATA_PROPERTY) + @Override public void setMetadata(Metadata metadata); - /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ - @Override @ISProperty(name = Type.NAME_PROPERTY, readonly = true, mandatory = true, nullable = false) public String getName(); @@ -53,6 +68,6 @@ public interface PropertyType

extends PropertyElement @ISProperty(name = Type.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false) public Set getProperties(); - /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /*Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java b/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java index dec326a..9b3cb14 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java @@ -1,10 +1,14 @@ package org.gcube.informationsystem.types.reference.relations; import java.util.Set; +import java.util.UUID; +import org.gcube.com.fasterxml.jackson.annotation.JsonGetter; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.gcube.com.fasterxml.jackson.annotation.JsonSetter; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.gcube.informationsystem.base.reference.relations.RelationElement; +import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl; import org.gcube.informationsystem.types.reference.Change; @@ -26,7 +30,25 @@ public interface RelationType public static final String NAME = "RelationType"; // RelationType.class.getSimpleName(); - /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + + @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) + @Override + public UUID getUUID(); + + @JsonSetter(value = UUID_PROPERTY) + @Override + public void setUUID(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.") + @Override + public Metadata getMetadata(); + + @JsonSetter(value = METADATA_PROPERTY) + @Override + public void setMetadata(Metadata metadata); @Override @ISProperty(name = Type.NAME_PROPERTY, readonly = true, mandatory = true, nullable = false) @@ -54,7 +76,8 @@ public interface RelationType @Override public T getTarget(); - /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ + /*@JsonGetter(value=SOURCE_PROPERTY) public String getSourceType();