diff --git a/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java b/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java index f9a3a16..ca6f9a7 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java @@ -23,7 +23,7 @@ public interface EntityElement extends Element, IdentifiableElement { public static final String NAME = "EntityElement"; //Entity.class.getSimpleName(); /* Overriding getHeader method to create Header property in type */ - @ISProperty(name=HEADER_PROPERTY, mandatory=true, nullable=false) + @ISProperty(name=HEADER_PROPERTY, mandatory=true, nullable=false, description="Metadata associated with the instance that is automatically created/updated by the system.") @Override public Header getHeader(); diff --git a/src/main/java/org/gcube/informationsystem/model/reference/entities/Entity.java b/src/main/java/org/gcube/informationsystem/model/reference/entities/Entity.java index 899c974..9c87440 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/entities/Entity.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/entities/Entity.java @@ -17,7 +17,7 @@ import org.gcube.informationsystem.utils.Version; */ @Abstract //@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses -@TypeMetadata(name = Entity.NAME, description = "This is the base class for Entities", version = Version.MINIMAL_VERSION_STRING) +@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) public interface Entity extends EntityElement, ERElement { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/entities/Facet.java b/src/main/java/org/gcube/informationsystem/model/reference/entities/Facet.java index fd15d53..fdb4846 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/entities/Facet.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/entities/Facet.java @@ -19,7 +19,7 @@ import org.gcube.informationsystem.utils.Version; */ @Abstract // @JsonDeserialize(as=FacetImpl.class) Do not uncomment to manage subclasses -@TypeMetadata(name = "Facet", description = "This is the base class for Facets", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = "Facet", description = "This is the base type for any Facet", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface Facet extends Entity, SchemaMixedElement { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/entities/Resource.java b/src/main/java/org/gcube/informationsystem/model/reference/entities/Resource.java index 9461db0..94df85f 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/entities/Resource.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/entities/Resource.java @@ -34,7 +34,7 @@ import org.gcube.informationsystem.utils.Version; @RelatedResourcesEntry(source=Resource.class, relation=IsRelatedTo.class, target=Resource.class, description="Any Resource can be related to any other resource.") } ) -@TypeMetadata(name = Resource.NAME, description = "This is the base class for Resources", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = Resource.NAME, description = "This is the base type for any Resource", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface Resource extends Entity { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/properties/Encrypted.java b/src/main/java/org/gcube/informationsystem/model/reference/properties/Encrypted.java index d38ca51..7f9d9b7 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/properties/Encrypted.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/properties/Encrypted.java @@ -13,14 +13,15 @@ import org.gcube.informationsystem.utils.Version; * @author Luca Frosini (ISTI - CNR) */ @JsonDeserialize(as=EncryptedImpl.class) -@TypeMetadata(name = Encrypted.NAME, description = "This is the base class for Encrypted values", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = Encrypted.NAME, description = "This type is used to properly manage encrypted values across contexts.", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface Encrypted extends Property { public static final String NAME = "Encrypted"; // Encrypted.class.getSimpleName(); + public static final String VALUE = "value"; - @ISProperty(name=VALUE, readonly=false, mandatory=true, nullable=false) + @ISProperty(name=VALUE, readonly=false, mandatory=true, nullable=false, description = "The value to store encrypted in the IS") @JsonGetter(value=VALUE) public String getEncryptedValue(); diff --git a/src/main/java/org/gcube/informationsystem/model/reference/properties/Header.java b/src/main/java/org/gcube/informationsystem/model/reference/properties/Header.java index a527cbc..4ed1530 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/properties/Header.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/properties/Header.java @@ -21,7 +21,7 @@ import org.gcube.informationsystem.utils.Version; * @author Luca Frosini (ISTI - CNR) */ @JsonDeserialize(as=HeaderImpl.class) -@TypeMetadata(name = Header.NAME, description = "This class provides metadata per every IdentifiableElement", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = Header.NAME, description = "This type provides metadata per every IdentifiableElement", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface Header extends Property { @@ -44,24 +44,23 @@ public interface Header extends Property { */ public static final String __CONTEXTS = "contexts"; - + @ISProperty(name = CREATED_BY_PROPERTY, description = "The user that created the Entity or the Relation. It is initialized at Creation Time.", readonly = true, mandatory = true, nullable = false) + public String getCreatedBy(); + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Element.DATETIME_PATTERN) + @ISProperty(name = CREATION_TIME_PROPERTY, description = "Creation time. It is represented in the format " + Element.DATETIME_PATTERN + ".", readonly = true, mandatory = true, nullable = false) + public Date getCreationTime(); + + @ISProperty(name = LAST_UPDATE_BY_PROPERTY, description = "The user that made the last update to the Entity or the Relation. At Creation Time, it assumes the same value of " + CREATED_BY_PROPERTY + ".", mandatory = true, nullable = false) + public String getLastUpdateBy(); + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Element.DATETIME_PATTERN) + @ISProperty(name = LAST_UPDATE_TIME_PROPERTY, description = "Last Update time. At creation time it assumes the same value of " + CREATION_TIME_PROPERTY + ". It is represented in the format " + Element.DATETIME_PATTERN, mandatory = true, nullable = false) + public Date getLastUpdateTime(); + @ISProperty(name = UUID_PROPERTY, description = "This UUID is be used to identify the Entity or the Relation univocally.", readonly = true, mandatory = true, nullable = false) public UUID getUUID(); public void setUUID(UUID uuid); - - @ISProperty(name = CREATED_BY_PROPERTY, description = "The user that created the Entity or the Relation. It is initialized at creation time. ", readonly = true, mandatory = true, nullable = false) - public String getCreatedBy(); - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Element.DATETIME_PATTERN) - @ISProperty(name = CREATION_TIME_PROPERTY, description = "Creation time. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.", readonly = true, mandatory = true, nullable = false) - public Date getCreationTime(); - - @ISProperty(name = LAST_UPDATE_BY_PROPERTY, 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, nullable = false) - public String getLastUpdateBy(); - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Element.DATETIME_PATTERN) - @ISProperty(name = LAST_UPDATE_TIME_PROPERTY, 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, nullable = false) - public Date getLastUpdateTime(); - + } \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/model/reference/properties/PropagationConstraint.java b/src/main/java/org/gcube/informationsystem/model/reference/properties/PropagationConstraint.java index c47bd1d..97f9f72 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/properties/PropagationConstraint.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/properties/PropagationConstraint.java @@ -12,20 +12,21 @@ import org.gcube.informationsystem.utils.Version; /** * At any time entities and relations can be added or removed to/from a context or deleted. - * The PropagationConstraint property contained in each relation is a predefined Property type - * which indicates the behaviour to be held on a target entity when an event related to a context occurs - * in the source resource or directly to the relation. + * The PropagationConstraint property contained in each relation is a property + * which indicates the behaviour to be held on a target entity + * when an event related to a context occurs in the source resource + * or directly to the relation. * * The default values of propagation constraints are: * - IsRelatedTo: remove=keep, add=unpropagate; - * - ConsistsOf : remove=cascadeWhenOrphan, add=propagate. + * - ConsistsOf : remove=cascade, add=propagate. * * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Propagation_Constraint * * @author Luca Frosini (ISTI - CNR) */ @JsonDeserialize(as=PropagationConstraintImpl.class) -@TypeMetadata(name = PropagationConstraint.NAME, description = "This class provides propagation constraint for Relation", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = PropagationConstraint.NAME, description = "This type provides propagation constraint for Relation", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface PropagationConstraint extends Property { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/properties/Property.java b/src/main/java/org/gcube/informationsystem/model/reference/properties/Property.java index 8a51f93..4fab452 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/properties/Property.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/properties/Property.java @@ -25,7 +25,7 @@ import org.gcube.informationsystem.utils.Version; */ // @JsonIgnoreProperties(ignoreUnknown=true) @JsonDeserialize(as=PropertyImpl.class) -@TypeMetadata(name = Property.NAME, description = "This is the base class for Properties", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = Property.NAME, description = "This is the base type for any Property", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface Property extends PropertyElement, SchemaMixedElement { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/relations/ConsistsOf.java b/src/main/java/org/gcube/informationsystem/model/reference/relations/ConsistsOf.java index c09b77a..9d34e78 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/relations/ConsistsOf.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/relations/ConsistsOf.java @@ -17,7 +17,7 @@ import org.gcube.informationsystem.utils.Version; * @author Luca Frosini (ISTI - CNR) */ @JsonDeserialize(as=ConsistsOfImpl.class) -@TypeMetadata(name = ConsistsOf.NAME, description = "This is the base class for ConsistsOf relations", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = ConsistsOf.NAME, description = "This is the base type for any ConsistsOf relation", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface ConsistsOf extends Relation { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/relations/IsRelatedTo.java b/src/main/java/org/gcube/informationsystem/model/reference/relations/IsRelatedTo.java index c448d85..76da3f2 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/relations/IsRelatedTo.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/relations/IsRelatedTo.java @@ -16,7 +16,7 @@ import org.gcube.informationsystem.utils.Version; */ @Abstract // @JsonDeserialize(as=IsRelatedToImpl.class) Do not uncomment to manage subclasses -@TypeMetadata(name = IsRelatedTo.NAME, description = "This is the base class for IsRelatedTo relations", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = IsRelatedTo.NAME, description = "This is the base type for any IsRelatedTo relation", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface IsRelatedTo extends Relation { diff --git a/src/main/java/org/gcube/informationsystem/model/reference/relations/Relation.java b/src/main/java/org/gcube/informationsystem/model/reference/relations/Relation.java index 6f48c8e..4bedf34 100644 --- a/src/main/java/org/gcube/informationsystem/model/reference/relations/Relation.java +++ b/src/main/java/org/gcube/informationsystem/model/reference/relations/Relation.java @@ -31,7 +31,7 @@ import org.gcube.informationsystem.utils.Version; */ @Abstract // @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses -@TypeMetadata(name = Relation.NAME, description = "This is the base class for Relations", version = Version.MINIMAL_VERSION_STRING) +@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) public interface Relation extends RelationElement, SchemaMixedElement, ERElement { diff --git a/src/main/java/org/gcube/informationsystem/types/impl/TypeImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/TypeImpl.java index e52fc04..9033249 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/TypeImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/TypeImpl.java @@ -104,9 +104,9 @@ public class TypeImpl implements Type { return interfaceList; } - protected Set retrieveListOfProperties(Class type) { + protected Set retrieveListOfProperties(Class clz) { Set properties = new HashSet<>(); - for (Method m : type.getDeclaredMethods()) { + for (Method m : clz.getDeclaredMethods()) { m.setAccessible(true); if (m.isAnnotationPresent(ISProperty.class)) { if (m.isBridge()) { @@ -115,7 +115,7 @@ public class TypeImpl implements Type { ISProperty propAnnotation = m.getAnnotation(ISProperty.class); PropertyDefinition prop = new PropertyDefinitionImpl(propAnnotation, m); properties.add(prop); - logger.trace("Property {} retrieved in type {} ", prop, type.getSimpleName()); + logger.trace("Property {} retrieved in type {} ", prop, clz.getSimpleName()); } } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java b/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java index e79b7bd..acf10ca 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java @@ -16,7 +16,7 @@ import org.gcube.informationsystem.utils.Version; * @author Luca Frosini (ISTI - CNR) */ @JsonDeserialize(as=LinkedEntityImpl.class) -@TypeMetadata(name = LinkedEntity.NAME, description = " A convenient type to define a Resource in terms of: mandatory/recommended ConsistsOf->Facets; uggested IsRelatedTo->Resource.", version = Version.MINIMAL_VERSION_STRING) +@TypeMetadata(name = LinkedEntity.NAME, description = " A convenient type to define a Resource in terms of: mandatory/recommended ConsistsOf->Facets; suggested IsRelatedTo->Resource.", version = Version.MINIMAL_VERSION_STRING) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) public interface LinkedEntity extends PropertyElement {