Renamed TypeVersion class to Version

This commit is contained in:
Luca Frosini 2021-10-21 10:11:45 +02:00
parent 05b6b65fee
commit 66fead0851
45 changed files with 174 additions and 174 deletions

View File

@ -9,7 +9,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -17,8 +17,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
@Abstract @Abstract
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = Element.CLASS_PROPERTY) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = Element.CLASS_PROPERTY)
// @JsonTypeIdResolver(ElementTypeIdResolver.class) // @JsonTypeIdResolver(ElementTypeIdResolver.class)
@TypeMetadata(name = Element.NAME, description = "This is the base class for Element", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Element.NAME, description = "This is the base class for Element", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Element extends Serializable { public interface Element extends Serializable {
public static final String NAME = "Element"; //Element.class.getSimpleName(); public static final String NAME = "Element"; //Element.class.getSimpleName();

View File

@ -8,7 +8,7 @@ import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -16,8 +16,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
@Abstract @Abstract
@JsonIgnoreProperties(ignoreUnknown=true) @JsonIgnoreProperties(ignoreUnknown=true)
//@JsonDeserialize(as=EntityElementImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=EntityElementImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = EntityElement.NAME, description = "This is the base class for any EntityElement", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = EntityElement.NAME, description = "This is the base class for any EntityElement", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface EntityElement extends Element, IdentifiableElement { public interface EntityElement extends Element, IdentifiableElement {
public static final String NAME = "EntityElement"; //Entity.class.getSimpleName(); public static final String NAME = "EntityElement"; //Entity.class.getSimpleName();

View File

@ -5,7 +5,7 @@ import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* Root Class for Property types. * Root Class for Property types.
@ -14,8 +14,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=PropertyElementImpl.class) @JsonDeserialize(as=PropertyElementImpl.class)
@TypeMetadata(name = PropertyElement.NAME, description = "This is the base class for any PropertyElement", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = PropertyElement.NAME, description = "This is the base class for any PropertyElement", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface PropertyElement extends Element { public interface PropertyElement extends Element {
public static final String NAME = "PropertyElement"; //PropertyElement.class.getSimpleName(); public static final String NAME = "PropertyElement"; //PropertyElement.class.getSimpleName();

View File

@ -10,15 +10,15 @@ import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@Abstract @Abstract
//@JsonDeserialize(as=RelationElementImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=RelationElementImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = RelationElement.NAME, description = "This is the base class for any RelationElement", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = RelationElement.NAME, description = "This is the base class for any RelationElement", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface RelationElement<S extends EntityElement, T extends EntityElement> extends Element, IdentifiableElement { public interface RelationElement<S extends EntityElement, T extends EntityElement> extends Element, IdentifiableElement {
public static final String NAME = "RelationElement"; // RelationElement.class.getSimpleName(); public static final String NAME = "RelationElement"; // RelationElement.class.getSimpleName();

View File

@ -17,7 +17,7 @@ import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Context * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Context
@ -25,8 +25,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as = ContextImpl.class) @JsonDeserialize(as = ContextImpl.class)
@TypeMetadata(name = Context.NAME, description = "This class is the used to define a Context", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Context.NAME, description = "This class is the used to define a Context", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Context extends EntityElement { public interface Context extends EntityElement {
public static final String NAME = "Context"; // Context.class.getSimpleName(); public static final String NAME = "Context"; // Context.class.getSimpleName();

View File

@ -12,7 +12,7 @@ import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl;
import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#IsParentOf * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#IsParentOf
@ -20,8 +20,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as = IsParentOfImpl.class) @JsonDeserialize(as = IsParentOfImpl.class)
@TypeMetadata(name = IsParentOf.NAME, description = "This class is the used to define parental relations between Context", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = IsParentOf.NAME, description = "This class is the used to define parental relations between Context", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface IsParentOf extends RelationElement<Context,Context> { public interface IsParentOf extends RelationElement<Context,Context> {
public static final String NAME = "IsParentOf"; //IsParentOf.class.getSimpleName(); public static final String NAME = "IsParentOf"; //IsParentOf.class.getSimpleName();

View File

@ -9,13 +9,13 @@ import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@TypeMetadata(name = Facet.NAME, description = "This is a dummy class for Facet", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Facet.NAME, description = "This is a dummy class for Facet", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public class DummyFacet extends FacetImpl implements Facet { public class DummyFacet extends FacetImpl implements Facet {
/** /**

View File

@ -9,13 +9,13 @@ import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@TypeMetadata(name = Resource.NAME, description = "This is a dummy class for Resource", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Resource.NAME, description = "This is a dummy class for Resource", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public class DummyResource extends ResourceImpl implements Resource { public class DummyResource extends ResourceImpl implements Resource {
/** /**

View File

@ -8,13 +8,13 @@ import org.gcube.informationsystem.model.reference.properties.PropagationConstra
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@TypeMetadata(name = IsRelatedTo.NAME, description = "This is a dummy class for IsRelatedTo", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = IsRelatedTo.NAME, description = "This is a dummy class for IsRelatedTo", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public class DummyIsRelatedTo<S extends Resource, T extends Resource> public class DummyIsRelatedTo<S extends Resource, T extends Resource>
extends IsRelatedToImpl<S, T> implements IsRelatedTo<S, T>{ extends IsRelatedToImpl<S, T> implements IsRelatedTo<S, T>{

View File

@ -8,7 +8,7 @@ import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Entity * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Entity
@ -17,8 +17,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
*/ */
@Abstract @Abstract
//@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = Entity.NAME, description = "This is the base class for Entities", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Entity.NAME, description = "This is the base class for Entities", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Entity extends EntityElement, ERElement { public interface Entity extends EntityElement, ERElement {
public static final String NAME = "Entity"; //Entity.class.getSimpleName(); public static final String NAME = "Entity"; //Entity.class.getSimpleName();

View File

@ -10,7 +10,7 @@ import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer; import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -19,8 +19,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
*/ */
@Abstract @Abstract
// @JsonDeserialize(as=FacetImpl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=FacetImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = "Facet", description = "This is the base class for Facets", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = "Facet", description = "This is the base class for Facets", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Facet extends Entity, SchemaMixedElement { public interface Facet extends Entity, SchemaMixedElement {
public static final String NAME = "Facet"; //Facet.class.getSimpleName(); public static final String NAME = "Facet"; //Facet.class.getSimpleName();

View File

@ -16,7 +16,7 @@ import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry;
import org.gcube.informationsystem.types.annotations.RelatedResourcesEntry; import org.gcube.informationsystem.types.annotations.RelatedResourcesEntry;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Resource * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Resource
@ -34,8 +34,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
@RelatedResourcesEntry(source=Resource.class, relation=IsRelatedTo.class, target=Resource.class, description="Any Resource can be related to any other resource.") @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 = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Resource.NAME, description = "This is the base class for Resources", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Resource extends Entity { public interface Resource extends Entity {
public static final String NAME = "Resource"; //Resource.class.getSimpleName(); public static final String NAME = "Resource"; //Resource.class.getSimpleName();

View File

@ -7,14 +7,14 @@ import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=EncryptedImpl.class) @JsonDeserialize(as=EncryptedImpl.class)
@TypeMetadata(name = Encrypted.NAME, description = "This is the base class for Encrypted values", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Encrypted.NAME, description = "This is the base class for Encrypted values", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Encrypted extends Property { public interface Encrypted extends Property {
public static final String NAME = "Encrypted"; // Encrypted.class.getSimpleName(); public static final String NAME = "Encrypted"; // Encrypted.class.getSimpleName();

View File

@ -13,7 +13,7 @@ import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header
@ -21,8 +21,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=HeaderImpl.class) @JsonDeserialize(as=HeaderImpl.class)
@TypeMetadata(name = Header.NAME, description = "This class provides metadata per every IdentifiableElement", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Header.NAME, description = "This class provides metadata per every IdentifiableElement", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Header extends Property { public interface Header extends Property {
public static final String NAME = "Header"; // Header.class.getSimpleName(); public static final String NAME = "Header"; // Header.class.getSimpleName();

View File

@ -8,7 +8,7 @@ import org.gcube.informationsystem.model.impl.properties.PropagationConstraintIm
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* At any time entities and relations can be added or removed to/from a context or deleted. * At any time entities and relations can be added or removed to/from a context or deleted.
@ -25,8 +25,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=PropagationConstraintImpl.class) @JsonDeserialize(as=PropagationConstraintImpl.class)
@TypeMetadata(name = PropagationConstraint.NAME, description = "This class provides propation constraint for Relation", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = PropagationConstraint.NAME, description = "This class provides propation constraint for Relation", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface PropagationConstraint extends Property { public interface PropagationConstraint extends Property {
public static final String NAME = "PropagationConstraint"; // PropagationConstraint.class.getSimpleName(); public static final String NAME = "PropagationConstraint"; // PropagationConstraint.class.getSimpleName();

View File

@ -15,7 +15,7 @@ import org.gcube.informationsystem.model.impl.properties.PropertyImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer; import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* Root Class for Property types. * Root Class for Property types.
@ -25,8 +25,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
*/ */
// @JsonIgnoreProperties(ignoreUnknown=true) // @JsonIgnoreProperties(ignoreUnknown=true)
@JsonDeserialize(as=PropertyImpl.class) @JsonDeserialize(as=PropertyImpl.class)
@TypeMetadata(name = Property.NAME, description = "This is the base class for Properties", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Property.NAME, description = "This is the base class for Properties", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Property extends PropertyElement, SchemaMixedElement { public interface Property extends PropertyElement, SchemaMixedElement {
public static final String NAME = "Property"; //Property.class.getSimpleName(); public static final String NAME = "Property"; //Property.class.getSimpleName();

View File

@ -9,7 +9,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#ConsistsOf * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#ConsistsOf
@ -17,8 +17,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=ConsistsOfImpl.class) @JsonDeserialize(as=ConsistsOfImpl.class)
@TypeMetadata(name = ConsistsOf.NAME, description = "This is the base class for ConsistsOf relations", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = ConsistsOf.NAME, description = "This is the base class for ConsistsOf relations", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface ConsistsOf<S extends Resource, T extends Facet> public interface ConsistsOf<S extends Resource, T extends Facet>
extends Relation<S, T> { extends Relation<S, T> {

View File

@ -7,7 +7,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -16,8 +16,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
*/ */
@Abstract @Abstract
// @JsonDeserialize(as=IsRelatedToImpl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=IsRelatedToImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = IsRelatedTo.NAME, description = "This is the base class for IsRelatedTo relations", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = IsRelatedTo.NAME, description = "This is the base class for IsRelatedTo relations", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface IsRelatedTo<S extends Resource, T extends Resource> public interface IsRelatedTo<S extends Resource, T extends Resource>
extends Relation<S, T> { extends Relation<S, T> {

View File

@ -22,7 +22,7 @@ import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer; import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -31,8 +31,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
*/ */
@Abstract @Abstract
// @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses
@TypeMetadata(name = Relation.NAME, description = "This is the base class for Relations", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Relation.NAME, description = "This is the base class for Relations", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Relation<S extends Resource, T extends Entity> extends RelationElement<S,T>, SchemaMixedElement, ERElement { public interface Relation<S extends Resource, T extends Entity> extends RelationElement<S,T>, SchemaMixedElement, ERElement {
public static final String NAME = "Relation"; //Relation.class.getSimpleName(); public static final String NAME = "Relation"; //Relation.class.getSimpleName();

View File

@ -12,7 +12,7 @@ import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.querytemplates.reference.entities.QueryTemplate; import org.gcube.informationsystem.querytemplates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty; import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable; import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -28,10 +28,10 @@ public class QueryTemplatesImpl implements QueryTemplate {
protected String name; protected String name;
protected String description; protected String description;
protected TypeVersion version; protected Version version;
@JsonProperty(value = CHANGELOG_PROPERTY, required = true) @JsonProperty(value = CHANGELOG_PROPERTY, required = true)
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
protected Map<TypeVersion, String> changelog; protected Map<Version, String> changelog;
protected TemplateProperty templateProperty; protected TemplateProperty templateProperty;
protected Set<TemplateVariable> templateDefaultValues; protected Set<TemplateVariable> templateDefaultValues;
@ -72,12 +72,12 @@ public class QueryTemplatesImpl implements QueryTemplate {
} }
@Override @Override
public TypeVersion getVersion() { public Version getVersion() {
return version; return version;
} }
@Override @Override
public void setVersion(TypeVersion typeVersion) { public void setVersion(Version typeVersion) {
this.version = typeVersion; this.version = typeVersion;
} }
@ -88,16 +88,16 @@ public class QueryTemplatesImpl implements QueryTemplate {
@Override @Override
public void setVersion(String version) { public void setVersion(String version) {
this.version = new TypeVersion(version); this.version = new Version(version);
} }
@Override @Override
public Map<TypeVersion, String> getChangelog() { public Map<Version, String> getChangelog() {
return changelog; return changelog;
} }
@Override @Override
public void addChangelog(TypeVersion typeVersion, String changeDescription) { public void addChangelog(Version typeVersion, String changeDescription) {
if(changelog.get(typeVersion)!=null) { if(changelog.get(typeVersion)!=null) {
throw new RuntimeException("Changelog for version " + typeVersion.toString() + " alread exists"); throw new RuntimeException("Changelog for version " + typeVersion.toString() + " alread exists");
} }
@ -107,14 +107,14 @@ public class QueryTemplatesImpl implements QueryTemplate {
@Override @Override
public Map<String, String> getChangelogWithVersionAsString() { public Map<String, String> getChangelogWithVersionAsString() {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for (TypeVersion typeVersion : changelog.keySet()) { for (Version typeVersion : changelog.keySet()) {
map.put(typeVersion.toString(), changelog.get(typeVersion)); map.put(typeVersion.toString(), changelog.get(typeVersion));
} }
return map; return map;
} }
@Override @Override
public void setChangelog(Map<TypeVersion, String> changelog) { public void setChangelog(Map<Version, String> changelog) {
this.changelog = changelog; this.changelog = changelog;
} }
@ -122,13 +122,13 @@ public class QueryTemplatesImpl implements QueryTemplate {
public void setChangelogWithVersionAsString(Map<String, String> changelog) { public void setChangelogWithVersionAsString(Map<String, String> changelog) {
this.changelog = new HashMap<>(); this.changelog = new HashMap<>();
for (String version : changelog.keySet()) { for (String version : changelog.keySet()) {
this.changelog.put(new TypeVersion(version), changelog.get(version)); this.changelog.put(new Version(version), changelog.get(version));
} }
} }
@Override @Override
public void addChangelog(String version, String changeDescription) { public void addChangelog(String version, String changeDescription) {
TypeVersion typeVersion = new TypeVersion(version); Version typeVersion = new Version(version);
addChangelog(typeVersion, changeDescription); addChangelog(typeVersion, changeDescription);
} }

View File

@ -18,7 +18,7 @@ import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -26,8 +26,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
@Abstract @Abstract
@JsonIgnoreProperties(ignoreUnknown=true) @JsonIgnoreProperties(ignoreUnknown=true)
@JsonDeserialize(as=QueryTemplatesImpl.class) @JsonDeserialize(as=QueryTemplatesImpl.class)
@TypeMetadata(name = QueryTemplate.NAME, description = "The type used to store Query Templates", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = QueryTemplate.NAME, description = "The type used to store Query Templates", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface QueryTemplate extends IdentifiableElement { public interface QueryTemplate extends IdentifiableElement {
public static final String NAME = "QueryTemplates"; //QueryTemplates.class.getSimpleName(); public static final String NAME = "QueryTemplates"; //QueryTemplates.class.getSimpleName();
@ -51,9 +51,9 @@ public interface QueryTemplate extends IdentifiableElement {
public void setDescription(String description); public void setDescription(String description);
@JsonIgnore @JsonIgnore
public TypeVersion getVersion(); public Version getVersion();
public void setVersion(TypeVersion typeVersion); public void setVersion(Version typeVersion);
@JsonGetter(value = VERSION_PROPERTY) @JsonGetter(value = VERSION_PROPERTY)
@ISProperty(name = VERSION_PROPERTY, description = "The version of the Query Template.", readonly = false, mandatory = true, nullable = false) @ISProperty(name = VERSION_PROPERTY, description = "The version of the Query Template.", readonly = false, mandatory = true, nullable = false)
@ -63,13 +63,13 @@ public interface QueryTemplate extends IdentifiableElement {
public void setVersion(String version); public void setVersion(String version);
@JsonIgnore @JsonIgnore
public Map<TypeVersion, String> getChangelog(); public Map<Version, String> getChangelog();
@JsonIgnore @JsonIgnore
public void setChangelog(Map<TypeVersion, String> changelog); public void setChangelog(Map<Version, String> changelog);
@JsonIgnore @JsonIgnore
public void addChangelog(TypeVersion typeVersion, String changeDescription); public void addChangelog(Version typeVersion, String changeDescription);
@JsonGetter(value = CHANGELOG_PROPERTY) @JsonGetter(value = CHANGELOG_PROPERTY)
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)

View File

@ -5,14 +5,14 @@ import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.querytemplates.impl.properties.TemplatePropertyImpl; import org.gcube.informationsystem.querytemplates.impl.properties.TemplatePropertyImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=TemplatePropertyImpl.class) @JsonDeserialize(as=TemplatePropertyImpl.class)
@TypeMetadata(name = TemplateProperty.NAME, description = "This is the class used to define the TemplateProperty", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = TemplateProperty.NAME, description = "This is the class used to define the TemplateProperty", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface TemplateProperty extends PropertyElement { public interface TemplateProperty extends PropertyElement {
public static final String NAME = "TemplateProperty"; // TemplateProperty.class.getSimpleName(); public static final String NAME = "TemplateProperty"; // TemplateProperty.class.getSimpleName();

View File

@ -6,14 +6,14 @@ import org.gcube.informationsystem.querytemplates.impl.properties.TemplateProper
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=TemplatePropertyImpl.class) @JsonDeserialize(as=TemplatePropertyImpl.class)
@TypeMetadata(name = TemplateVariable.NAME, description = "This is the class used to define the a TemplateVariable", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = TemplateVariable.NAME, description = "This is the class used to define the a TemplateVariable", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface TemplateVariable extends PropertyElement { public interface TemplateVariable extends PropertyElement {
public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName(); public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName();

View File

@ -16,7 +16,7 @@ import java.util.UUID;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -144,7 +144,7 @@ public class PropertyTypeName {
BASE_PROPERTY_TYPES_BY_CLASS.put(URI.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(URI.class, BaseType.STRING);
BASE_PROPERTY_TYPES_BY_CLASS.put(URL.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(URL.class, BaseType.STRING);
BASE_PROPERTY_TYPES_BY_CLASS.put(UUID.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(UUID.class, BaseType.STRING);
BASE_PROPERTY_TYPES_BY_CLASS.put(TypeVersion.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(Version.class, BaseType.STRING);
} }

View File

@ -24,7 +24,7 @@ import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -144,25 +144,25 @@ public class TypeMapper {
} }
} }
public static TypeVersion getTypeVersion(Class<? extends Element> clz){ public static Version getTypeVersion(Class<? extends Element> clz){
String classSimpleName = clz.getSimpleName(); String classSimpleName = clz.getSimpleName();
if(clz.isAnnotationPresent(TypeMetadata.class)) { if(clz.isAnnotationPresent(TypeMetadata.class)) {
TypeMetadata typeMetadata = clz.getAnnotation(TypeMetadata.class); TypeMetadata typeMetadata = clz.getAnnotation(TypeMetadata.class);
return new TypeVersion(typeMetadata.version()); return new Version(typeMetadata.version());
}else { }else {
throw new RuntimeException("You must provide @TypeMetadata for " + classSimpleName); throw new RuntimeException("You must provide @TypeMetadata for " + classSimpleName);
} }
} }
public static Map<TypeVersion, String> getTypeChangelog(Class<? extends Element> clz){ public static Map<Version, String> getTypeChangelog(Class<? extends Element> clz){
Map<TypeVersion, String> map = new HashMap<>(); Map<Version, String> map = new HashMap<>();
if(clz.isAnnotationPresent(Changelog.class)) { if(clz.isAnnotationPresent(Changelog.class)) {
Changelog changelog = clz.getAnnotation(Changelog.class); Changelog changelog = clz.getAnnotation(Changelog.class);
Change[] changes = changelog.value(); Change[] changes = changelog.value();
for(Change change : changes) { for(Change change : changes) {
String version = change.version(); String version = change.version();
TypeVersion typeVersion = new TypeVersion(version); Version typeVersion = new Version(version);
if(map.containsKey(typeVersion)) { if(map.containsKey(typeVersion)) {
throw new RuntimeException("Duplicated version " + version +" in @Change annotation"); throw new RuntimeException("Duplicated version " + version +" in @Change annotation");
} }
@ -176,11 +176,11 @@ public class TypeMapper {
} }
} }
if(!map.containsKey(TypeVersion.MINIMAL_VERSION)) { if(!map.containsKey(Version.MINIMAL_VERSION)) {
map.putAll(TypeImpl.DEFAULT_CHANGELOG_MAP); map.putAll(TypeImpl.DEFAULT_CHANGELOG_MAP);
} }
TypeVersion typeVersion = getTypeVersion(clz); Version typeVersion = getTypeVersion(clz);
if (!map.containsKey(typeVersion)) { if (!map.containsKey(typeVersion)) {
throw new RuntimeException("The Type " + clz.getSimpleName() + " does not provided the appropriated changelog Map"); throw new RuntimeException("The Type " + clz.getSimpleName() + " does not provided the appropriated changelog Map");
} }

View File

@ -29,7 +29,7 @@ import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl; import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -51,14 +51,14 @@ public class TypeImpl implements Type {
public final static String CHANGELOG = "CHANGELOG"; public final static String CHANGELOG = "CHANGELOG";
*/ */
public static final Map<TypeVersion, String> DEFAULT_CHANGELOG_MAP; public static final Map<Version, String> DEFAULT_CHANGELOG_MAP;
private static final Map<String, String> DEFAULT_CHANGELOG_MAP_KEY_AS_STRING; private static final Map<String, String> DEFAULT_CHANGELOG_MAP_KEY_AS_STRING;
static { static {
DEFAULT_CHANGELOG_MAP = new HashMap<>(); DEFAULT_CHANGELOG_MAP = new HashMap<>();
DEFAULT_CHANGELOG_MAP.put(new TypeVersion(TypeVersion.MINIMAL_VERSION_STRING), TypeVersion.MINIMAL_VERSION_DESCRIPTION); DEFAULT_CHANGELOG_MAP.put(new Version(Version.MINIMAL_VERSION_STRING), Version.MINIMAL_VERSION_DESCRIPTION);
DEFAULT_CHANGELOG_MAP_KEY_AS_STRING = new HashMap<>(); DEFAULT_CHANGELOG_MAP_KEY_AS_STRING = new HashMap<>();
DEFAULT_CHANGELOG_MAP_KEY_AS_STRING.put(TypeVersion.MINIMAL_VERSION_STRING, TypeVersion.MINIMAL_VERSION_DESCRIPTION); DEFAULT_CHANGELOG_MAP_KEY_AS_STRING.put(Version.MINIMAL_VERSION_STRING, Version.MINIMAL_VERSION_DESCRIPTION);
} }
@ -66,10 +66,10 @@ public class TypeImpl implements Type {
protected String name; protected String name;
protected String description; protected String description;
protected TypeVersion version; protected Version version;
@JsonProperty(value = CHANGELOG_PROPERTY, required = false) @JsonProperty(value = CHANGELOG_PROPERTY, required = false)
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
protected Map<TypeVersion, String> changelog; protected Map<Version, String> changelog;
@JsonProperty(value = "abstract") @JsonProperty(value = "abstract")
protected boolean abstractType; protected boolean abstractType;
@ -204,7 +204,7 @@ public class TypeImpl implements Type {
} }
@Override @Override
public TypeVersion getVersion() { public Version getVersion() {
return version; return version;
} }
@ -215,11 +215,11 @@ public class TypeImpl implements Type {
@JsonSetter(value = VERSION_PROPERTY) @JsonSetter(value = VERSION_PROPERTY)
public void setVersion(String version) { public void setVersion(String version) {
this.version = new TypeVersion(version); this.version = new Version(version);
} }
@Override @Override
public Map<TypeVersion, String> getChangelog() { public Map<Version, String> getChangelog() {
return changelog; return changelog;
} }
@ -230,7 +230,7 @@ public class TypeImpl implements Type {
return DEFAULT_CHANGELOG_MAP_KEY_AS_STRING; return DEFAULT_CHANGELOG_MAP_KEY_AS_STRING;
} }
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for (TypeVersion typeVersion : changelog.keySet()) { for (Version typeVersion : changelog.keySet()) {
map.put(typeVersion.toString(), changelog.get(typeVersion)); map.put(typeVersion.toString(), changelog.get(typeVersion));
} }
return map; return map;
@ -244,7 +244,7 @@ public class TypeImpl implements Type {
} }
this.changelog = new HashMap<>(); this.changelog = new HashMap<>();
for (String version : changelog.keySet()) { for (String version : changelog.keySet()) {
this.changelog.put(new TypeVersion(version), changelog.get(version)); this.changelog.put(new Version(version), changelog.get(version));
} }
} }

View File

@ -12,7 +12,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.types.PropertyTypeName; import org.gcube.informationsystem.types.PropertyTypeName;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -108,8 +108,8 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
if(URL.class.isAssignableFrom(clz)){ if(URL.class.isAssignableFrom(clz)){
this.regexp = URL_REGEX; this.regexp = URL_REGEX;
} }
if(TypeVersion.class.isAssignableFrom(clz)){ if(Version.class.isAssignableFrom(clz)){
this.regexp = TypeVersion.TYPE_VERSION_REGEX; this.regexp = Version.VERSION_REGEX;
} }
} }

View File

@ -10,15 +10,15 @@ import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@Abstract @Abstract
@JsonIgnoreProperties(ignoreUnknown=true) @JsonIgnoreProperties(ignoreUnknown=true)
@TypeMetadata(name = Type.NAME, description = "This is the base class to define any Type", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Type.NAME, description = "This is the base class to define any Type", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
//@JsonDeserialize(as=TypeImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=TypeImpl.class) Do not uncomment to manage subclasses
public interface Type extends IdentifiableElement { public interface Type extends IdentifiableElement {
@ -37,13 +37,13 @@ public interface Type extends IdentifiableElement {
public String getDescription(); public String getDescription();
@JsonIgnore @JsonIgnore
public TypeVersion getVersion(); public Version getVersion();
@JsonGetter(value = VERSION_PROPERTY) @JsonGetter(value = VERSION_PROPERTY)
public String getVersionAsString(); public String getVersionAsString();
@JsonIgnore @JsonIgnore
public Map<TypeVersion, String> getChangelog(); public Map<Version, String> getChangelog();
@JsonGetter(value = CHANGELOG_PROPERTY) @JsonGetter(value = CHANGELOG_PROPERTY)
public Map<String, String> getChangelogWithVersionAsString(); public Map<String, String> getChangelogWithVersionAsString();

View File

@ -7,7 +7,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -21,6 +21,6 @@ public @interface TypeMetadata {
String description() default ""; String description() default "";
String version() default TypeVersion.MINIMAL_VERSION_STRING; String version() default Version.MINIMAL_VERSION_STRING;
} }

View File

@ -10,15 +10,15 @@ import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = EntityTypeImpl.class) @JsonDeserialize(as = EntityTypeImpl.class)
@TypeMetadata(name = EntityType.NAME, description = "This class provides information for any EntityType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = EntityType.NAME, description = "This class provides information for any EntityType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface EntityType extends Type, EntityElement { public interface EntityType extends Type, EntityElement {
public static final String NAME = "EntityType"; //EntityType.class.getSimpleName(); public static final String NAME = "EntityType"; //EntityType.class.getSimpleName();

View File

@ -10,15 +10,15 @@ import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = FacetTypeImpl.class) @JsonDeserialize(as = FacetTypeImpl.class)
@TypeMetadata(name = FacetType.NAME, description = "This class provides information for the definition of any FacetType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = FacetType.NAME, description = "This class provides information for the definition of any FacetType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface FacetType extends EntityType { public interface FacetType extends EntityType {
public static final String NAME = "FacetType"; //FacetType.class.getSimpleName(); public static final String NAME = "FacetType"; //FacetType.class.getSimpleName();

View File

@ -8,14 +8,14 @@ import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=ResourceTypeImpl.class) @JsonDeserialize(as=ResourceTypeImpl.class)
@TypeMetadata(name = ResourceType.NAME, description = "This class provides information for the definition of any ResourceType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = ResourceType.NAME, description = "This class provides information for the definition of any ResourceType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface ResourceType extends EntityType { public interface ResourceType extends EntityType {
public static final String NAME = "ResourceType"; //ResourceType.class.getSimpleName(); public static final String NAME = "ResourceType"; //ResourceType.class.getSimpleName();

View File

@ -7,15 +7,15 @@ import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyDefinitionImpl.class) @JsonDeserialize(as = PropertyDefinitionImpl.class)
@TypeMetadata(name = Changelog.NAME, description = "This class provides version information for any Type", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = Changelog.NAME, description = "This class provides version information for any Type", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Changelog extends PropertyElement { public interface Changelog extends PropertyElement {
public static final String NAME = "Changelog"; public static final String NAME = "Changelog";
@ -24,7 +24,7 @@ public interface Changelog extends PropertyElement {
public static final String CHANGE_PROPERTY = "changelog"; public static final String CHANGE_PROPERTY = "changelog";
@ISProperty(name = VERSION_PROPERTY, readonly = true, mandatory = true, nullable = false, regexpr = "") @ISProperty(name = VERSION_PROPERTY, readonly = true, mandatory = true, nullable = false, regexpr = "")
public TypeVersion getVersion(); public Version getVersion();
@ISProperty(name = CHANGE_PROPERTY, readonly = true, mandatory = true, nullable = false) @ISProperty(name = CHANGE_PROPERTY, readonly = true, mandatory = true, nullable = false)
public String getChange(); public String getChange();

View File

@ -6,7 +6,7 @@ import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.LinkedEntityImpl; import org.gcube.informationsystem.types.impl.properties.LinkedEntityImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* A convenient type to define a Resource in terms of: * A convenient type to define a Resource in terms of:
@ -16,8 +16,8 @@ import org.gcube.informationsystem.utils.TypeVersion;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=LinkedEntityImpl.class) @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 = TypeVersion.MINIMAL_VERSION_STRING) @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)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface LinkedEntity extends PropertyElement { public interface LinkedEntity extends PropertyElement {
public static final String NAME = "LinkedEntity"; // LinkedEntity.class.getSimpleName(); public static final String NAME = "LinkedEntity"; // LinkedEntity.class.getSimpleName();

View File

@ -7,15 +7,15 @@ import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyDefinitionImpl.class) @JsonDeserialize(as = PropertyDefinitionImpl.class)
@TypeMetadata(name = PropertyDefinition.NAME, description = "This class provides information for the definition of any properties", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = PropertyDefinition.NAME, description = "This class provides information for the definition of any properties", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface PropertyDefinition extends PropertyElement { public interface PropertyDefinition extends PropertyElement {
public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName(); public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName();

View File

@ -12,15 +12,15 @@ import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyTypeImpl.class) @JsonDeserialize(as = PropertyTypeImpl.class)
@TypeMetadata(name = PropertyType.NAME, description = "This class provides information for any PropertyType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = PropertyType.NAME, description = "This class provides information for any PropertyType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface PropertyType<P extends PropertyElement> extends PropertyElement, Type { public interface PropertyType<P extends PropertyElement> extends PropertyElement, Type {
public static final String NAME = "PropertyType"; // PropertyTypeDefinition.class.getSimpleName(); public static final String NAME = "PropertyType"; // PropertyTypeDefinition.class.getSimpleName();

View File

@ -6,14 +6,14 @@ import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.types.reference.entities.FacetType; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as = ConsistsOfTypeImpl.class) @JsonDeserialize(as = ConsistsOfTypeImpl.class)
@TypeMetadata(name = ConsistsOfType.NAME, description = "This class provides information for any ConsistsOfType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = ConsistsOfType.NAME, description = "This class provides information for any ConsistsOfType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface ConsistsOfType extends RelationType<ResourceType, FacetType> { public interface ConsistsOfType extends RelationType<ResourceType, FacetType> {
public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName(); public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName();

View File

@ -5,14 +5,14 @@ import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeImpl;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as = IsRelatedToTypeImpl.class) @JsonDeserialize(as = IsRelatedToTypeImpl.class)
@TypeMetadata(name = IsRelatedToType.NAME, description = "This class provides information for any IsRelatedToType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = IsRelatedToType.NAME, description = "This class provides information for any IsRelatedToType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface IsRelatedToType extends RelationType<ResourceType, ResourceType> { public interface IsRelatedToType extends RelationType<ResourceType, ResourceType> {
public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName(); public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName();

View File

@ -12,15 +12,15 @@ import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = RelationTypeImpl.class) @JsonDeserialize(as = RelationTypeImpl.class)
@TypeMetadata(name = RelationType.NAME, description = "This class provides information for any RelationType", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = RelationType.NAME, description = "This class provides information for any RelationType", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface RelationType<S extends EntityType, T extends EntityType> public interface RelationType<S extends EntityType, T extends EntityType>
extends Type, RelationElement<S,T> { extends Type, RelationElement<S,T> {

View File

@ -7,20 +7,20 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
/** /**
* A class representing and validating a version in the following format X.X.X (Major.Minor.Revision) * A class representing and validating a version in the following format X.X.X (Major.Minor.Revision)
* Each part is an integer with no trailing zeros (e.g 1 and not 01). * Each part is an integer with no trailing zeros (e.g 1 and not 01).
* The version is validated by the regex defined in the static field {@link TypeVersion#TYPE_VERSION_REGEX} * The version is validated by the regex defined in the static field {@link Version#VERSION_REGEX}
* *
* Accepted initial version is {@link TypeVersion#MINIMAL_VERSION_STRING} * Accepted initial version is {@link Version#MINIMAL_VERSION_STRING}
* *
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class TypeVersion implements Comparable<TypeVersion> { public class Version implements Comparable<Version> {
/** /**
* Regex validating the version * Regex validating the version
*/ */
public final static String TYPE_VERSION_REGEX = "^[1-9][0-9]{0,}\\.(0|([1-9][0-9]{0,}))\\.(0|([1-9][0-9]{0,}))$"; public final static String VERSION_REGEX = "^[1-9][0-9]{0,}\\.(0|([1-9][0-9]{0,}))\\.(0|([1-9][0-9]{0,}))$";
private final static Pattern TYPE_VERSION_PATTERN; private final static Pattern VERSION_PATTERN;
/** /**
* Accepted initial version * Accepted initial version
@ -30,7 +30,7 @@ public class TypeVersion implements Comparable<TypeVersion> {
/** /**
* Accepted initial version as TypeVersion instance * Accepted initial version as TypeVersion instance
*/ */
public static final TypeVersion MINIMAL_VERSION; public static final Version MINIMAL_VERSION;
/** /**
* Default changelog description for the initial version * Default changelog description for the initial version
@ -38,8 +38,8 @@ public class TypeVersion implements Comparable<TypeVersion> {
public static final String MINIMAL_VERSION_DESCRIPTION = "First Version"; public static final String MINIMAL_VERSION_DESCRIPTION = "First Version";
static { static {
TYPE_VERSION_PATTERN = Pattern.compile(TYPE_VERSION_REGEX); VERSION_PATTERN = Pattern.compile(VERSION_REGEX);
MINIMAL_VERSION = new TypeVersion(MINIMAL_VERSION_STRING); MINIMAL_VERSION = new Version(MINIMAL_VERSION_STRING);
} }
@JsonIgnore @JsonIgnore
@ -49,13 +49,13 @@ public class TypeVersion implements Comparable<TypeVersion> {
@JsonIgnore @JsonIgnore
protected int revision; protected int revision;
protected TypeVersion(){} protected Version(){}
public TypeVersion(String version) { public Version(String version) {
setVersion(version); setVersion(version);
} }
public TypeVersion(int major, int minor, int revision) { public Version(int major, int minor, int revision) {
this.major = major; this.major = major;
this.minor = minor; this.minor = minor;
this.revision = revision; this.revision = revision;
@ -63,8 +63,8 @@ public class TypeVersion implements Comparable<TypeVersion> {
} }
public void setVersion(String version) { public void setVersion(String version) {
if(!TYPE_VERSION_PATTERN.matcher(version).matches()) { if(!VERSION_PATTERN.matcher(version).matches()) {
throw new RuntimeException("The provided version (i.e. " + version + ") MUST respect the regex " + TYPE_VERSION_REGEX); throw new RuntimeException("The provided version (i.e. " + version + ") MUST respect the regex " + VERSION_REGEX);
} }
String[] parts = version.split("\\."); String[] parts = version.split("\\.");
this.major = Integer.valueOf(parts[0]); this.major = Integer.valueOf(parts[0]);
@ -114,7 +114,7 @@ public class TypeVersion implements Comparable<TypeVersion> {
return major + "." + minor + "." + revision; return major + "." + minor + "." + revision;
} }
@Override @Override
public int compareTo(TypeVersion other) { public int compareTo(Version other) {
if(other == null) { if(other == null) {
return 1; return 1;
} }
@ -151,7 +151,7 @@ public class TypeVersion implements Comparable<TypeVersion> {
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
TypeVersion other = (TypeVersion) obj; Version other = (Version) obj;
if (major != other.major) if (major != other.major)
return false; return false;
if (minor != other.minor) if (minor != other.minor)

View File

@ -3,13 +3,13 @@ package org.gcube.informationsystem.types;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@TypeMetadata(name = "EntityParent", description = "This is a test Entity", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = "EntityParent", description = "This is a test Entity", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface EntityParent extends EntityParentParent { public interface EntityParent extends EntityParentParent {
@ISProperty(nullable=false) @ISProperty(nullable=false)

View File

@ -3,13 +3,13 @@ package org.gcube.informationsystem.types;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@TypeMetadata(name = "EntityTest", description = "This is a test Entity", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = "EntityTest", description = "This is a test Entity", version = Version.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface EntityTest extends EntityParent { public interface EntityTest extends EntityParent {
@ISProperty(nullable=false) @ISProperty(nullable=false)

View File

@ -26,7 +26,7 @@ import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -194,7 +194,7 @@ public class SerializationTest {
logger.info(serialized); logger.info(serialized);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyType<Header> propertyType = (PropertyType<Header>) TypeMapper.deserializeTypeDefinition(serialized); PropertyType<Header> propertyType = (PropertyType<Header>) TypeMapper.deserializeTypeDefinition(serialized);
TypeVersion typeVersion = propertyType.getVersion(); Version typeVersion = propertyType.getVersion();
logger.debug("Version {}", typeVersion.toString()); logger.debug("Version {}", typeVersion.toString());
logger.info(ElementMapper.marshal(propertyType)); logger.info(ElementMapper.marshal(propertyType));

View File

@ -14,13 +14,13 @@ public class TypeVersionTest {
@Test @Test
public void testPatterns() throws Exception { public void testPatterns() throws Exception {
for(String version : validVersions) { for(String version : validVersions) {
TypeVersion typeVersion = new TypeVersion(version); Version typeVersion = new Version(version);
Assert.assertTrue(version.compareTo(typeVersion.toString())==0); Assert.assertTrue(version.compareTo(typeVersion.toString())==0);
} }
for(String version : inValidVersions) { for(String version : inValidVersions) {
try { try {
TypeVersion typeVersion = new TypeVersion(version); Version typeVersion = new Version(version);
throw new Exception("The version " + version + " is not valid but the validation succeded. Parsed version is " + typeVersion.toString()); throw new Exception("The version " + version + " is not valid but the validation succeded. Parsed version is " + typeVersion.toString());
}catch (RuntimeException e) { }catch (RuntimeException e) {
// OK // OK

View File

@ -14,7 +14,7 @@ import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.Version;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -44,13 +44,13 @@ public class ISMDiscoveryTest {
Assert.assertTrue(expected.getSuperClasses().containsAll(type.getSuperClasses())); Assert.assertTrue(expected.getSuperClasses().containsAll(type.getSuperClasses()));
Map<TypeVersion, String> typeChangelog = type.getChangelog(); Map<Version, String> typeChangelog = type.getChangelog();
Map<TypeVersion, String> typeManagedChangelog = expected.getChangelog(); Map<Version, String> typeManagedChangelog = expected.getChangelog();
Assert.assertTrue(typeChangelog.keySet().containsAll(typeManagedChangelog.keySet())); Assert.assertTrue(typeChangelog.keySet().containsAll(typeManagedChangelog.keySet()));
Assert.assertTrue(typeManagedChangelog.keySet().containsAll(typeChangelog.keySet())); Assert.assertTrue(typeManagedChangelog.keySet().containsAll(typeChangelog.keySet()));
for(TypeVersion typeVersion : typeChangelog.keySet()) { for(Version typeVersion : typeChangelog.keySet()) {
Assert.assertTrue(typeChangelog.get(typeVersion).compareTo(typeManagedChangelog.get(typeVersion))==0); Assert.assertTrue(typeChangelog.get(typeVersion).compareTo(typeManagedChangelog.get(typeVersion))==0);
} }