From 05d6f6796dc667284dd29e948cee9cb078c880aa Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 30 Jan 2020 10:26:43 +0100 Subject: [PATCH] Reorganized model as following Element - EntityElement - Entity - Resource - Facet - Context - EntityType - ResourceType (3 lists of PropertyDefinition, LinkedFacet, LinkedResource) - FacetType (1 list of PropertyDefinition) - RelationElement - Relation - IsRelatedTo - ConsistsOf - IsParentOf - RelationType - IsRelatedTo (1 list of PropertyDefinition) - ConsistsOf (1 list of PropertyDefinition) - PropertyElement - Property - Header - PropagationConstraint - Encrypted - PropertyType (1 list of PropertyDefinition) - PropertyDefinition - LinkedEntity - LinkedFacet - LinkedResource --- .../informationsystem/base/impl/ERImpl.java | 2 +- ...ISManageableImpl.java => ElementImpl.java} | 6 +- .../base/impl/entities/EImpl.java | 5 -- ...EntityImpl.java => EntityElementImpl.java} | 8 +-- ...ertyImpl.java => PropertyElementImpl.java} | 10 +-- ...tionImpl.java => RelationElementImpl.java} | 13 ++-- .../base/reference/AccessType.java | 52 +++++++------- .../informationsystem/base/reference/ER.java | 2 +- .../{ISManageable.java => Element.java} | 6 +- .../{BaseEntity.java => EntityElement.java} | 6 +- ...BaseProperty.java => PropertyElement.java} | 8 +-- ...BaseRelation.java => RelationElement.java} | 8 +-- .../context/impl/entities/ContextImpl.java | 4 +- .../impl/relations/IsParentOfImpl.java | 4 +- .../context/reference/entities/Context.java | 4 +- .../reference/relations/IsParentOf.java | 4 +- .../model/impl/entities/EntityImpl.java | 4 +- .../model/impl/entities/FacetImpl.java | 4 +- .../model/impl/properties/PropertyImpl.java | 4 +- .../model/impl/relations/RelationImpl.java | 8 +-- .../model/reference/entities/Entity.java | 4 +- .../model/reference/properties/Property.java | 4 +- .../model/reference/relations/Relation.java | 4 +- .../types/{Type.java => OrientDBType.java} | 2 +- .../informationsystem/types/TypeBinder.java | 12 ++-- .../types/impl/TypeDefinitionImpl.java | 34 +++++----- ...efinitionImpl.java => EntityTypeImpl.java} | 32 ++++----- ...DefinitionImpl.java => FacetTypeImpl.java} | 10 +-- ...initionImpl.java => ResourceTypeImpl.java} | 26 +++---- ...initionImpl.java => LinkedEntityImpl.java} | 10 +-- .../properties/PropertyDefinitionImpl.java | 22 +++--- .../PropertyTypeDefinitionImpl.java | 28 -------- .../impl/properties/PropertyTypeImpl.java | 28 ++++++++ ...itionImpl.java => ConsistsOfTypeImpl.java} | 22 +++--- ...tionImpl.java => IsRelatedToTypeImpl.java} | 18 ++--- ...initionImpl.java => RelationTypeImpl.java} | 68 +++++++++---------- ...ityTypeDefinition.java => EntityType.java} | 10 +-- .../types/reference/entities/FacetType.java | 15 ++++ .../entities/FacetTypeDefinition.java | 15 ---- ...eTypeDefinition.java => ResourceType.java} | 14 ++-- ...EntryDefinition.java => LinkedEntity.java} | 10 +-- .../properties/PropertyDefinition.java | 4 +- ...yTypeDefinition.java => PropertyType.java} | 10 +-- ...ypeDefinition.java => ConsistsOfType.java} | 12 ++-- .../reference/relations/IsRelatedToType.java | 16 +++++ .../relations/IsRelatedToTypeDefinition.java | 16 ----- ...nTypeDefinition.java => RelationType.java} | 14 ++-- ...rializer.java => ElementDeserializer.java} | 10 +-- .../informationsystem/utils/ISMapper.java | 34 +++++----- .../utils/ISMappingAction.java | 12 ++-- .../utils/discovery/ISMDiscovery.java | 26 +++---- .../utils/discovery/SchemaAction.java | 12 ++-- .../types/EntitySchemaDefinition.java | 8 +-- .../types/SerializationTest.java | 66 +++++++++--------- .../utils/discovery/ISMDiscoveryTest.java | 8 +-- 55 files changed, 398 insertions(+), 400 deletions(-) rename src/main/java/org/gcube/informationsystem/base/impl/{ISManageableImpl.java => ElementImpl.java} (77%) delete mode 100644 src/main/java/org/gcube/informationsystem/base/impl/entities/EImpl.java rename src/main/java/org/gcube/informationsystem/base/impl/entities/{BaseEntityImpl.java => EntityElementImpl.java} (82%) rename src/main/java/org/gcube/informationsystem/base/impl/properties/{BasePropertyImpl.java => PropertyElementImpl.java} (55%) rename src/main/java/org/gcube/informationsystem/base/impl/relations/{BaseRelationImpl.java => RelationElementImpl.java} (55%) rename src/main/java/org/gcube/informationsystem/base/reference/{ISManageable.java => Element.java} (70%) rename src/main/java/org/gcube/informationsystem/base/reference/entities/{BaseEntity.java => EntityElement.java} (74%) rename src/main/java/org/gcube/informationsystem/base/reference/properties/{BaseProperty.java => PropertyElement.java} (55%) rename src/main/java/org/gcube/informationsystem/base/reference/relations/{BaseRelation.java => RelationElement.java} (72%) rename src/main/java/org/gcube/informationsystem/types/{Type.java => OrientDBType.java} (99%) rename src/main/java/org/gcube/informationsystem/types/impl/entities/{EntityTypeDefinitionImpl.java => EntityTypeImpl.java} (67%) rename src/main/java/org/gcube/informationsystem/types/impl/entities/{FacetTypeDefinitionImpl.java => FacetTypeImpl.java} (68%) rename src/main/java/org/gcube/informationsystem/types/impl/entities/{ResourceTypeDefinitionImpl.java => ResourceTypeImpl.java} (75%) rename src/main/java/org/gcube/informationsystem/types/impl/properties/{ResourceEntryDefinitionImpl.java => LinkedEntityImpl.java} (79%) delete mode 100644 src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeDefinitionImpl.java create mode 100644 src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeImpl.java rename src/main/java/org/gcube/informationsystem/types/impl/relations/{ConsistsOfTypeDefinitionImpl.java => ConsistsOfTypeImpl.java} (73%) rename src/main/java/org/gcube/informationsystem/types/impl/relations/{IsRelatedToTypeDefinitionImpl.java => IsRelatedToTypeImpl.java} (72%) rename src/main/java/org/gcube/informationsystem/types/impl/relations/{RelationTypeDefinitionImpl.java => RelationTypeImpl.java} (57%) rename src/main/java/org/gcube/informationsystem/types/reference/entities/{EntityTypeDefinition.java => EntityType.java} (83%) create mode 100644 src/main/java/org/gcube/informationsystem/types/reference/entities/FacetType.java delete mode 100644 src/main/java/org/gcube/informationsystem/types/reference/entities/FacetTypeDefinition.java rename src/main/java/org/gcube/informationsystem/types/reference/entities/{ResourceTypeDefinition.java => ResourceType.java} (61%) rename src/main/java/org/gcube/informationsystem/types/reference/properties/{ResourceEntryDefinition.java => LinkedEntity.java} (79%) rename src/main/java/org/gcube/informationsystem/types/reference/properties/{PropertyTypeDefinition.java => PropertyType.java} (82%) rename src/main/java/org/gcube/informationsystem/types/reference/relations/{ConsistsOfTypeDefinition.java => ConsistsOfType.java} (51%) create mode 100644 src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToType.java delete mode 100644 src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToTypeDefinition.java rename src/main/java/org/gcube/informationsystem/types/reference/relations/{RelationTypeDefinition.java => RelationType.java} (81%) rename src/main/java/org/gcube/informationsystem/utils/{ERDeserializer.java => ElementDeserializer.java} (93%) diff --git a/src/main/java/org/gcube/informationsystem/base/impl/ERImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/ERImpl.java index 86f285f..e1959a4 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/ERImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/ERImpl.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value=ER.NAME) -public abstract class ERImpl extends ISManageableImpl implements ER { +public abstract class ERImpl extends ElementImpl implements ER { /** * Generated Serial Version UID diff --git a/src/main/java/org/gcube/informationsystem/base/impl/ISManageableImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/ElementImpl.java similarity index 77% rename from src/main/java/org/gcube/informationsystem/base/impl/ISManageableImpl.java rename to src/main/java/org/gcube/informationsystem/base/impl/ElementImpl.java index df97dac..6f24ac3 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/ISManageableImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/ElementImpl.java @@ -5,21 +5,21 @@ package org.gcube.informationsystem.base.impl; import java.io.StringWriter; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.utils.ISMapper; /** * @author Luca Frosini (ISTI - CNR) * */ -public class ISManageableImpl implements ISManageable { +public class ElementImpl implements Element { /** * */ private static final long serialVersionUID = 7338083489551084860L; - public ISManageableImpl(){ + public ElementImpl(){ } diff --git a/src/main/java/org/gcube/informationsystem/base/impl/entities/EImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/entities/EImpl.java deleted file mode 100644 index ffd9b2d..0000000 --- a/src/main/java/org/gcube/informationsystem/base/impl/entities/EImpl.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.gcube.informationsystem.base.impl.entities; - -public class EImpl { - -} diff --git a/src/main/java/org/gcube/informationsystem/base/impl/entities/BaseEntityImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java similarity index 82% rename from src/main/java/org/gcube/informationsystem/base/impl/entities/BaseEntityImpl.java rename to src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java index 0f40dcd..6cd43af 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/entities/BaseEntityImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/entities/EntityElementImpl.java @@ -3,22 +3,22 @@ package org.gcube.informationsystem.base.impl.entities; import java.io.StringWriter; import org.gcube.informationsystem.base.impl.ERImpl; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.utils.ISMapper; import com.fasterxml.jackson.annotation.JsonTypeName; -@JsonTypeName(value=BaseEntity.NAME) -public abstract class BaseEntityImpl extends ERImpl implements Entity { +@JsonTypeName(value=EntityElement.NAME) +public abstract class EntityElementImpl extends ERImpl implements Entity { /** * Generated Serial Version UID */ private static final long serialVersionUID = -4488771434017342703L; - protected BaseEntityImpl(){ + protected EntityElementImpl(){ super(); this.header = null; } diff --git a/src/main/java/org/gcube/informationsystem/base/impl/properties/BasePropertyImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/properties/PropertyElementImpl.java similarity index 55% rename from src/main/java/org/gcube/informationsystem/base/impl/properties/BasePropertyImpl.java rename to src/main/java/org/gcube/informationsystem/base/impl/properties/PropertyElementImpl.java index 2a93950..31cfbbd 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/properties/BasePropertyImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/properties/PropertyElementImpl.java @@ -1,7 +1,7 @@ package org.gcube.informationsystem.base.impl.properties; -import org.gcube.informationsystem.base.impl.ISManageableImpl; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.impl.ElementImpl; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.model.reference.properties.Property; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -9,15 +9,15 @@ import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=BaseProperty.NAME) -public class BasePropertyImpl extends ISManageableImpl implements Property { +@JsonTypeName(value=PropertyElement.NAME) +public class PropertyElementImpl extends ElementImpl implements Property { /** * Generated Serial Version UID */ private static final long serialVersionUID = 1396998430221747445L; - public BasePropertyImpl() { + public PropertyElementImpl() { super(); } diff --git a/src/main/java/org/gcube/informationsystem/base/impl/relations/BaseRelationImpl.java b/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java similarity index 55% rename from src/main/java/org/gcube/informationsystem/base/impl/relations/BaseRelationImpl.java rename to src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java index 05f4024..eaad7fe 100644 --- a/src/main/java/org/gcube/informationsystem/base/impl/relations/BaseRelationImpl.java +++ b/src/main/java/org/gcube/informationsystem/base/impl/relations/RelationElementImpl.java @@ -1,10 +1,13 @@ package org.gcube.informationsystem.base.impl.relations; import org.gcube.informationsystem.base.impl.ERImpl; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; -public abstract class BaseRelationImpl extends ERImpl implements BaseRelation { +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName(value=RelationElement.NAME) +public abstract class RelationElementImpl extends ERImpl implements RelationElement { /** * Generated Serial Version UID @@ -14,11 +17,11 @@ public abstract class BaseRelationImpl clz; - private final Class implementationClass; - private final Class dummyImplementationClass; + private final Class clz; + private final Class implementationClass; + private final Class dummyImplementationClass; private final String name; private final String lowerCaseFirstCharacter; - + AccessType(Class clz, String name, Class implementationClass, Class dummyImplementationClass){ this.clz = clz; this.implementationClass = implementationClass; @@ -94,17 +94,17 @@ public enum AccessType { } @SuppressWarnings("unchecked") - public Class getTypeClass(){ + public Class getTypeClass(){ return (Class) clz; } @SuppressWarnings("unchecked") - public Class getImplementationClass() { + public Class getImplementationClass() { return (Class) implementationClass; } @SuppressWarnings("unchecked") - public Class getDummyImplementationClass() { + public Class getDummyImplementationClass() { return (Class) dummyImplementationClass; } @@ -126,7 +126,7 @@ public enum AccessType { AccessType[] accessTypes = AccessType.values(); for (AccessType accessType : accessTypes) { - Class typeClass = accessType.getTypeClass(); + Class typeClass = accessType.getTypeClass(); if (typeClass.isAssignableFrom(clz)) { if(ret==null || ret.getTypeClass().isAssignableFrom(typeClass)){ ret = accessType; diff --git a/src/main/java/org/gcube/informationsystem/base/reference/ER.java b/src/main/java/org/gcube/informationsystem/base/reference/ER.java index 29ce103..e860b2d 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/ER.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/ER.java @@ -11,7 +11,7 @@ import org.gcube.informationsystem.model.reference.properties.Header; */ // @JsonDeserialize(as=ERImpl.class) Do not uncomment to manage subclasses // @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = ER.HEADER_PROPERTY) -public interface ER extends ISManageable { +public interface ER extends Element { public static final String NAME = "ER"; //ER.class.getSimpleName(); diff --git a/src/main/java/org/gcube/informationsystem/base/reference/ISManageable.java b/src/main/java/org/gcube/informationsystem/base/reference/Element.java similarity index 70% rename from src/main/java/org/gcube/informationsystem/base/reference/ISManageable.java rename to src/main/java/org/gcube/informationsystem/base/reference/Element.java index d57f825..59adfed 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/ISManageable.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/Element.java @@ -13,10 +13,10 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; * @author Luca Frosini (ISTI - CNR) */ @Abstract -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = ISManageable.CLASS_PROPERTY) -public interface ISManageable extends Serializable { +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = Element.CLASS_PROPERTY) +public interface Element extends Serializable { - public static final String NAME = "ISManageable"; //ISManageable.class.getSimpleName(); + public static final String NAME = "Element"; //Element.class.getSimpleName(); public static final String CLASS_PROPERTY = "@class"; diff --git a/src/main/java/org/gcube/informationsystem/base/reference/entities/BaseEntity.java b/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java similarity index 74% rename from src/main/java/org/gcube/informationsystem/base/reference/entities/BaseEntity.java rename to src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java index eed14cf..71b1a3e 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/entities/BaseEntity.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/entities/EntityElement.java @@ -9,10 +9,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Abstract @JsonIgnoreProperties(ignoreUnknown=true) -//@JsonDeserialize(as=BaseEntityImpl.class) Do not uncomment to manage subclasses -public interface BaseEntity extends ER { +//@JsonDeserialize(as=EntityElementImpl.class) Do not uncomment to manage subclasses +public interface EntityElement extends ER { - public static final String NAME = "BaseEntity"; //Entity.class.getSimpleName(); + 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) diff --git a/src/main/java/org/gcube/informationsystem/base/reference/properties/BaseProperty.java b/src/main/java/org/gcube/informationsystem/base/reference/properties/PropertyElement.java similarity index 55% rename from src/main/java/org/gcube/informationsystem/base/reference/properties/BaseProperty.java rename to src/main/java/org/gcube/informationsystem/base/reference/properties/PropertyElement.java index ddc3c69..0c44e8a 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/properties/BaseProperty.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/properties/PropertyElement.java @@ -1,16 +1,16 @@ package org.gcube.informationsystem.base.reference.properties; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.Element; /** * @author Luca Frosini (ISTI - CNR) * Root Class for Property types. It creates a base common type, which is useful * for management purpose. */ -// @JsonDeserialize(as=BasePropertympl.class) Do not uncomment to manage subclasses -public interface BaseProperty extends ISManageable { +// @JsonDeserialize(as=PropertyElementmpl.class) Do not uncomment to manage subclasses +public interface PropertyElement extends Element { - public static final String NAME = "BaseProperty"; //BaseProperty.class.getSimpleName(); + public static final String NAME = "PropertyElement"; //PropertyElement.class.getSimpleName(); public static final String DESCRIPTION = "This is the very base class for Property"; public static final String VERSION = "1.0.0"; diff --git a/src/main/java/org/gcube/informationsystem/base/reference/relations/BaseRelation.java b/src/main/java/org/gcube/informationsystem/base/reference/relations/RelationElement.java similarity index 72% rename from src/main/java/org/gcube/informationsystem/base/reference/relations/BaseRelation.java rename to src/main/java/org/gcube/informationsystem/base/reference/relations/RelationElement.java index a246c40..f2a3913 100644 --- a/src/main/java/org/gcube/informationsystem/base/reference/relations/BaseRelation.java +++ b/src/main/java/org/gcube/informationsystem/base/reference/relations/RelationElement.java @@ -1,7 +1,7 @@ package org.gcube.informationsystem.base.reference.relations; import org.gcube.informationsystem.base.reference.ER; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.ISProperty; @@ -10,10 +10,10 @@ import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; @Abstract -//@JsonDeserialize(as=BaseRelationImpl.class) Do not uncomment to manage subclasses -public interface BaseRelation extends ER { +//@JsonDeserialize(as=RelationElementImpl.class) Do not uncomment to manage subclasses +public interface RelationElement extends ER { - public static final String NAME = "BaseRelation"; // BaseRelation.class.getSimpleName(); + public static final String NAME = "RelationElement"; // RelationElement.class.getSimpleName(); public static final String SOURCE_PROPERTY = "source"; public static final String TARGET_PROPERTY = "target"; diff --git a/src/main/java/org/gcube/informationsystem/context/impl/entities/ContextImpl.java b/src/main/java/org/gcube/informationsystem/context/impl/entities/ContextImpl.java index 217dad7..006d755 100644 --- a/src/main/java/org/gcube/informationsystem/context/impl/entities/ContextImpl.java +++ b/src/main/java/org/gcube/informationsystem/context/impl/entities/ContextImpl.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.gcube.informationsystem.base.impl.entities.BaseEntityImpl; +import org.gcube.informationsystem.base.impl.entities.EntityElementImpl; import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl; import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.relations.IsParentOf; @@ -22,7 +22,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value=Context.NAME) -public final class ContextImpl extends BaseEntityImpl implements Context { +public final class ContextImpl extends EntityElementImpl implements Context { /** * Generated Serial Version UID diff --git a/src/main/java/org/gcube/informationsystem/context/impl/relations/IsParentOfImpl.java b/src/main/java/org/gcube/informationsystem/context/impl/relations/IsParentOfImpl.java index 50a4bed..0eb8be0 100644 --- a/src/main/java/org/gcube/informationsystem/context/impl/relations/IsParentOfImpl.java +++ b/src/main/java/org/gcube/informationsystem/context/impl/relations/IsParentOfImpl.java @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.context.impl.relations; -import org.gcube.informationsystem.base.impl.relations.BaseRelationImpl; +import org.gcube.informationsystem.base.impl.relations.RelationElementImpl; import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.relations.IsParentOf; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value=IsParentOf.NAME) -public final class IsParentOfImpl extends BaseRelationImpl implements IsParentOf { +public final class IsParentOfImpl extends RelationElementImpl implements IsParentOf { /** * diff --git a/src/main/java/org/gcube/informationsystem/context/reference/entities/Context.java b/src/main/java/org/gcube/informationsystem/context/reference/entities/Context.java index 9ca700e..e87c5f1 100644 --- a/src/main/java/org/gcube/informationsystem/context/reference/entities/Context.java +++ b/src/main/java/org/gcube/informationsystem/context/reference/entities/Context.java @@ -6,7 +6,7 @@ package org.gcube.informationsystem.context.reference.entities; import java.util.List; import java.util.UUID; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.context.impl.entities.ContextImpl; import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.model.reference.relations.Relation; @@ -22,7 +22,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Context */ @JsonDeserialize(as = ContextImpl.class) -public interface Context extends BaseEntity { +public interface Context extends EntityElement { public static final String NAME = "Context"; // Context.class.getSimpleName(); diff --git a/src/main/java/org/gcube/informationsystem/context/reference/relations/IsParentOf.java b/src/main/java/org/gcube/informationsystem/context/reference/relations/IsParentOf.java index 82f1e61..d130b4b 100644 --- a/src/main/java/org/gcube/informationsystem/context/reference/relations/IsParentOf.java +++ b/src/main/java/org/gcube/informationsystem/context/reference/relations/IsParentOf.java @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.context.reference.relations; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl; import org.gcube.informationsystem.context.reference.entities.Context; @@ -17,7 +17,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#isParentOf */ @JsonDeserialize(as = IsParentOfImpl.class) -public interface IsParentOf extends BaseRelation { +public interface IsParentOf extends RelationElement { public static final String NAME = "IsParentOf"; //IsParentOf.class.getSimpleName(); diff --git a/src/main/java/org/gcube/informationsystem/model/impl/entities/EntityImpl.java b/src/main/java/org/gcube/informationsystem/model/impl/entities/EntityImpl.java index be32a5f..434d96a 100644 --- a/src/main/java/org/gcube/informationsystem/model/impl/entities/EntityImpl.java +++ b/src/main/java/org/gcube/informationsystem/model/impl/entities/EntityImpl.java @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.model.impl.entities; -import org.gcube.informationsystem.base.impl.entities.BaseEntityImpl; +import org.gcube.informationsystem.base.impl.entities.EntityElementImpl; import org.gcube.informationsystem.model.reference.entities.Entity; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value=Entity.NAME) -public abstract class EntityImpl extends BaseEntityImpl implements Entity { +public abstract class EntityImpl extends EntityElementImpl implements Entity { /** * Generated Serial Version UID diff --git a/src/main/java/org/gcube/informationsystem/model/impl/entities/FacetImpl.java b/src/main/java/org/gcube/informationsystem/model/impl/entities/FacetImpl.java index 3946ab4..a3f0df9 100644 --- a/src/main/java/org/gcube/informationsystem/model/impl/entities/FacetImpl.java +++ b/src/main/java/org/gcube/informationsystem/model/impl/entities/FacetImpl.java @@ -8,7 +8,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.utils.ISMapper; @@ -78,7 +78,7 @@ public abstract class FacetImpl extends EntityImpl implements Facet { if(value instanceof Map) { @SuppressWarnings("unchecked") Map map = (Map) value; - if(map.containsKey(ISManageable.CLASS_PROPERTY)) { + if(map.containsKey(Element.CLASS_PROPERTY)) { String reserialized = ISMapper.getObjectMapper().writeValueAsString(map); Property property = ISMapper.unmarshal(Property.class, reserialized); value = property; diff --git a/src/main/java/org/gcube/informationsystem/model/impl/properties/PropertyImpl.java b/src/main/java/org/gcube/informationsystem/model/impl/properties/PropertyImpl.java index 78a0d6e..d53a341 100644 --- a/src/main/java/org/gcube/informationsystem/model/impl/properties/PropertyImpl.java +++ b/src/main/java/org/gcube/informationsystem/model/impl/properties/PropertyImpl.java @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.model.impl.properties; -import org.gcube.informationsystem.base.impl.ISManageableImpl; +import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl; import org.gcube.informationsystem.model.reference.properties.Property; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value=Property.NAME) -public class PropertyImpl extends ISManageableImpl implements Property { +public class PropertyImpl extends PropertyElementImpl implements Property { /** * Generated Serial Version UID diff --git a/src/main/java/org/gcube/informationsystem/model/impl/relations/RelationImpl.java b/src/main/java/org/gcube/informationsystem/model/impl/relations/RelationImpl.java index a05b68f..5b8d522 100644 --- a/src/main/java/org/gcube/informationsystem/model/impl/relations/RelationImpl.java +++ b/src/main/java/org/gcube/informationsystem/model/impl/relations/RelationImpl.java @@ -8,8 +8,8 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.gcube.informationsystem.base.impl.relations.BaseRelationImpl; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.impl.relations.RelationElementImpl; +import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; @@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; */ @JsonTypeName(value = Relation.NAME) public abstract class RelationImpl - extends BaseRelationImpl implements Relation { + extends RelationElementImpl implements Relation { /** * @@ -106,7 +106,7 @@ public abstract class RelationImpl if(value instanceof Map) { @SuppressWarnings("unchecked") Map map = (Map) value; - if(map.containsKey(ISManageable.CLASS_PROPERTY)) { + if(map.containsKey(Element.CLASS_PROPERTY)) { String reserialized = ISMapper.getObjectMapper().writeValueAsString(map); Property property = ISMapper.unmarshal(Property.class, reserialized); value = property; 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 d4e2446..ac129b9 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 @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.model.reference.entities; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.types.annotations.Abstract; @@ -13,7 +13,7 @@ import org.gcube.informationsystem.types.annotations.Abstract; */ @Abstract //@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses -public interface Entity extends BaseEntity { +public interface Entity extends EntityElement { public static final String NAME = "Entity"; //Entity.class.getSimpleName(); 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 552ca55..112fab1 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 @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.model.reference.properties; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; /** * @author Luca Frosini (ISTI - CNR) @@ -12,7 +12,7 @@ import org.gcube.informationsystem.base.reference.properties.BaseProperty; */ // @JsonIgnoreProperties(ignoreUnknown=true) // @JsonDeserialize(as=PropertyImpl.class) Do not uncomment to manage subclasses -public interface Property extends BaseProperty { +public interface Property extends PropertyElement { public static final String NAME = "Property"; //Property.class.getSimpleName(); public static final String DESCRIPTION = "This is the base class for Property"; 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 68d058c..1cdf89b 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 @@ -5,7 +5,7 @@ package org.gcube.informationsystem.model.reference.relations; import java.util.Map; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; @@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; */ @Abstract // @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses -public interface Relation extends BaseRelation { +public interface Relation extends RelationElement { public static final String NAME = "Relation"; //Relation.class.getSimpleName(); diff --git a/src/main/java/org/gcube/informationsystem/types/Type.java b/src/main/java/org/gcube/informationsystem/types/OrientDBType.java similarity index 99% rename from src/main/java/org/gcube/informationsystem/types/Type.java rename to src/main/java/org/gcube/informationsystem/types/OrientDBType.java index d38caac..a52dd8e 100644 --- a/src/main/java/org/gcube/informationsystem/types/Type.java +++ b/src/main/java/org/gcube/informationsystem/types/OrientDBType.java @@ -43,7 +43,7 @@ import org.gcube.informationsystem.model.reference.properties.Property; * https://github.com/orientechnologies/orientdb/blob/master/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OType.java * and adapted for gCube purpose. */ -public class Type { +public class OrientDBType { public enum OType { BOOLEAN("Boolean", 0), diff --git a/src/main/java/org/gcube/informationsystem/types/TypeBinder.java b/src/main/java/org/gcube/informationsystem/types/TypeBinder.java index 04b617d..99bb2de 100644 --- a/src/main/java/org/gcube/informationsystem/types/TypeBinder.java +++ b/src/main/java/org/gcube/informationsystem/types/TypeBinder.java @@ -3,7 +3,7 @@ package org.gcube.informationsystem.types; import java.lang.reflect.Field; import java.util.List; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.utils.ISMapper; @@ -20,7 +20,7 @@ public class TypeBinder { return json; } - public static String serializeType(Class type) throws Exception{ + public static String serializeType(Class type) throws Exception{ TypeDefinition typeDefinition = createTypeDefinition(type); return ISMapper.marshal(typeDefinition); } @@ -30,7 +30,7 @@ public class TypeBinder { return readValue; } - public static String serializeTypeDefinitions(List typeDefinitions) throws Exception{ + public static String serializeTypeDefinitions(List typeDefinitions) throws Exception{ String json = ISMapper.marshal(typeDefinitions); return json; @@ -41,16 +41,16 @@ public class TypeBinder { return list; } - public static TypeDefinition createTypeDefinition(Class clz) { + public static TypeDefinition createTypeDefinition(Class clz) { TypeDefinition typeDefinition = TypeDefinitionImpl.getInstance(clz); return typeDefinition; } - public static String getType(Class clz){ + public static String getType(Class clz){ return getStaticStringFieldByName(clz, NAME, clz.getSimpleName()); } - public static String getStaticStringFieldByName(Class type, String fieldName, String defaultValue){ + public static String getStaticStringFieldByName(Class type, String fieldName, String defaultValue){ Field field; try { field = type.getDeclaredField(fieldName); diff --git a/src/main/java/org/gcube/informationsystem/types/impl/TypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/TypeDefinitionImpl.java index 408c561..ec6625a 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/TypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/TypeDefinitionImpl.java @@ -7,18 +7,18 @@ import java.util.HashSet; import java.util.Set; import org.gcube.informationsystem.base.impl.ERImpl; -import org.gcube.informationsystem.base.reference.ISManageable; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.Element; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; +import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; -import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; -import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl; +import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl; +import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl; import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.slf4j.Logger; @@ -48,7 +48,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition { protected Set properties; - protected Set retrieveSuperClasses(Class type, Class baseClass, String topSuperClass){ + protected Set retrieveSuperClasses(Class type, Class baseClass, String topSuperClass){ Set interfaceList = new HashSet<>(); if(type==baseClass){ @@ -67,7 +67,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition { } @SuppressWarnings("unchecked") - Class clz = (Class) interfaceClass; + Class clz = (Class) interfaceClass; interfaceList.add(TypeBinder.getType(clz)); } @@ -104,17 +104,17 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition { } @SuppressWarnings({"rawtypes", "unchecked"}) - public static TypeDefinition getInstance(Class clz) { + public static TypeDefinition getInstance(Class clz) { TypeDefinition typeDefinition = null; try { - if(BaseEntity.class.isAssignableFrom(clz)) { - typeDefinition = EntityTypeDefinitionImpl.getEntityTypeDefinitionInstance((Class) clz); + if(EntityElement.class.isAssignableFrom(clz)) { + typeDefinition = EntityTypeImpl.getEntityTypeDefinitionInstance((Class) clz); return typeDefinition; - } else if(BaseRelation.class.isAssignableFrom(clz)){ - typeDefinition = RelationTypeDefinitionImpl.getRelationTypeDefinitionInstance((Class>) clz); + } else if(RelationElement.class.isAssignableFrom(clz)){ + typeDefinition = RelationTypeImpl.getRelationTypeDefinitionInstance((Class>) clz); return typeDefinition; - } else if(BaseProperty.class.isAssignableFrom(clz)){ - typeDefinition = new PropertyTypeDefinitionImpl(clz); + } else if(PropertyElement.class.isAssignableFrom(clz)){ + typeDefinition = new PropertyTypeImpl(clz); return typeDefinition; } else if(TypeDefinition.class.isAssignableFrom(clz)) { typeDefinition = new TypeDefinitionImpl(clz); @@ -131,7 +131,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition { protected TypeDefinitionImpl() {} - protected TypeDefinitionImpl(Class clz) { + protected TypeDefinitionImpl(Class clz) { this.name = TypeBinder.getType(clz); this.description = TypeBinder.getStaticStringFieldByName(clz, DESCRIPTION, ""); this.abstractType = false; diff --git a/src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeImpl.java similarity index 67% rename from src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeImpl.java index d272f75..6e60357 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/entities/EntityTypeImpl.java @@ -2,13 +2,13 @@ package org.gcube.informationsystem.types.impl.entities; import java.io.StringWriter; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; +import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.utils.ISMapper; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=EntityTypeDefinition.NAME) -public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements EntityTypeDefinition { +@JsonTypeName(value=EntityType.NAME) +public class EntityTypeImpl extends TypeDefinitionImpl implements EntityType { /** * Generated Serial Version UID @@ -26,37 +26,37 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti // private static final String VERTEX_CLASS_NAME = "V"; - public static EntityTypeDefinition getEntityTypeDefinitionInstance(Class clz) { + public static EntityType getEntityTypeDefinitionInstance(Class clz) { if(Resource.class.isAssignableFrom(clz)) { @SuppressWarnings("unchecked") Class c = (Class) clz; - return new ResourceTypeDefinitionImpl((Class) c); + return new ResourceTypeImpl((Class) c); } else if(Facet.class.isAssignableFrom(clz)){ @SuppressWarnings("unchecked") Class c = (Class) clz; - return new FacetTypeDefinitionImpl(c); + return new FacetTypeImpl(c); } - return new EntityTypeDefinitionImpl(clz); + return new EntityTypeImpl(clz); } - protected EntityTypeDefinitionImpl() { + protected EntityTypeImpl() { super(); } - public EntityTypeDefinitionImpl(Class clz) { + public EntityTypeImpl(Class clz) { super(clz); - if(EntityTypeDefinition.class.isAssignableFrom(clz)){ + if(EntityType.class.isAssignableFrom(clz)){ @SuppressWarnings("unchecked") - Class c = (Class) clz; - this.superClasses = retrieveSuperClasses(c, EntityTypeDefinition.class, BaseEntity.NAME); + Class c = (Class) clz; + this.superClasses = retrieveSuperClasses(c, EntityType.class, EntityElement.NAME); } else if(Context.class.isAssignableFrom(clz)){ @SuppressWarnings("unchecked") Class c = (Class) clz; - this.superClasses = retrieveSuperClasses(c, Context.class, BaseEntity.NAME); - } else if(BaseEntity.class.isAssignableFrom(clz)){ - this.superClasses = retrieveSuperClasses(clz, BaseEntity.class, null); + this.superClasses = retrieveSuperClasses(c, Context.class, EntityElement.NAME); + } else if(EntityElement.class.isAssignableFrom(clz)){ + this.superClasses = retrieveSuperClasses(clz, EntityElement.class, null); } else { throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName()); } diff --git a/src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeImpl.java similarity index 68% rename from src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeImpl.java index 5a2a707..3d27bf6 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/entities/FacetTypeImpl.java @@ -2,26 +2,26 @@ package org.gcube.informationsystem.types.impl.entities; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; -import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; +import org.gcube.informationsystem.types.reference.entities.FacetType; import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=FacetTypeDefinition.NAME) -public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements FacetTypeDefinition { +@JsonTypeName(value=FacetType.NAME) +public class FacetTypeImpl extends EntityTypeImpl implements FacetType { /** * Generated Serial Version UID */ private static final long serialVersionUID = 6268161046955738969L; - protected FacetTypeDefinitionImpl() { + protected FacetTypeImpl() { super(); } - public FacetTypeDefinitionImpl(Class clz) { + public FacetTypeImpl(Class clz) { super(clz); this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME); diff --git a/src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeImpl.java similarity index 75% rename from src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeImpl.java index bfe289e..a2c5cb4 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/entities/ResourceTypeImpl.java @@ -9,31 +9,31 @@ import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.annotations.ResourceSchema; import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry; import org.gcube.informationsystem.types.annotations.ResourceSchemaRelatedEntry; -import org.gcube.informationsystem.types.impl.properties.ResourceEntryDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; -import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; +import org.gcube.informationsystem.types.impl.properties.LinkedEntityImpl; +import org.gcube.informationsystem.types.reference.entities.ResourceType; +import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=ResourceTypeDefinition.NAME) -public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl implements ResourceTypeDefinition { +@JsonTypeName(value=ResourceType.NAME) +public class ResourceTypeImpl extends EntityTypeImpl implements ResourceType { /** * Generated Serial Version UID */ private static final long serialVersionUID = -5964819173421808432L; - protected List facets; - protected List resources; + protected List facets; + protected List resources; - protected ResourceTypeDefinitionImpl() { + protected ResourceTypeImpl() { super(); } - public ResourceTypeDefinitionImpl(Class clz) { + public ResourceTypeImpl(Class clz) { super(clz); this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME); @@ -47,7 +47,7 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme this.resources = new ArrayList<>(); ResourceSchema[] resourceSchemaArray = clz.getAnnotationsByType(ResourceSchema.class); for(ResourceSchemaEntry resourceSchemaEntry : resourceSchemaArray[0].facets()) { - ResourceEntryDefinitionImpl resourceSchemaEntryDefinition = new ResourceEntryDefinitionImpl(); + LinkedEntityImpl resourceSchemaEntryDefinition = new LinkedEntityImpl(); resourceSchemaEntryDefinition.setSource(TypeBinder.getType(clz)); resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaEntry.relation())); resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaEntry.facet())); @@ -57,7 +57,7 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme this.facets.add(resourceSchemaEntryDefinition); } for(ResourceSchemaRelatedEntry resourceSchemaRelatedEntry : resourceSchemaArray[0].resources()) { - ResourceEntryDefinition resourceSchemaEntryDefinition = new ResourceEntryDefinitionImpl(); + LinkedEntity resourceSchemaEntryDefinition = new LinkedEntityImpl(); resourceSchemaEntryDefinition.setSource(TypeBinder.getType(resourceSchemaRelatedEntry.source())); resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaRelatedEntry.relation())); resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaRelatedEntry.target())); @@ -70,12 +70,12 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme } @Override - public List getFacets() { + public List getFacets() { return facets; } @Override - public List getResources() { + public List getResources() { return resources; } diff --git a/src/main/java/org/gcube/informationsystem/types/impl/properties/ResourceEntryDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/properties/LinkedEntityImpl.java similarity index 79% rename from src/main/java/org/gcube/informationsystem/types/impl/properties/ResourceEntryDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/properties/LinkedEntityImpl.java index 85c07d0..eeadef9 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/properties/ResourceEntryDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/properties/LinkedEntityImpl.java @@ -3,16 +3,16 @@ */ package org.gcube.informationsystem.types.impl.properties; -import org.gcube.informationsystem.base.impl.properties.BasePropertyImpl; -import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; +import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl; +import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=ResourceEntryDefinition.NAME) -public final class ResourceEntryDefinitionImpl extends BasePropertyImpl implements ResourceEntryDefinition { +@JsonTypeName(value=LinkedEntity.NAME) +public final class LinkedEntityImpl extends PropertyElementImpl implements LinkedEntity { /** * Generated Serial Version UID @@ -26,7 +26,7 @@ public final class ResourceEntryDefinitionImpl extends BasePropertyImpl implemen protected Integer min; protected Integer max; - public ResourceEntryDefinitionImpl() { + public LinkedEntityImpl() { super(); } diff --git a/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyDefinitionImpl.java index 2b28d27..1a76db0 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyDefinitionImpl.java @@ -6,10 +6,10 @@ import java.net.URI; import java.net.URL; import java.util.UUID; -import org.gcube.informationsystem.base.reference.ISManageable; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.types.Type; -import org.gcube.informationsystem.types.Type.OType; +import org.gcube.informationsystem.base.reference.Element; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.types.OrientDBType; +import org.gcube.informationsystem.types.OrientDBType.OType; import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; @@ -81,15 +81,15 @@ public final class PropertyDefinitionImpl implements PropertyDefinition { logger.trace("Looking for property type {}", method.getReturnType()); @SuppressWarnings("unchecked") - Class type = (Class) method.getReturnType(); + Class type = (Class) method.getReturnType(); this.type = OType.PROPERTY.getIntValue(); - if(BaseProperty.class.isAssignableFrom(type)){ - if(type != BaseProperty.class){ + if(PropertyElement.class.isAssignableFrom(type)){ + if(type != PropertyElement.class){ this.linkedClass = TypeBinder.getType(type); } - }else if (Type.getTypeByClass(type)!=null) { - this.type = Type.getTypeByClass(type).getIntValue(); + }else if (OrientDBType.getTypeByClass(type)!=null) { + this.type = OrientDBType.getTypeByClass(type).getIntValue(); if(this.type > 9 && this.type <= 12){ java.lang.reflect.Type genericReturnType = method.getGenericReturnType(); logger.trace("Generic Return Type {} for method {}", genericReturnType, method); @@ -103,8 +103,8 @@ public final class PropertyDefinitionImpl implements PropertyDefinition { } @SuppressWarnings("unchecked") - Class genericClass = (Class) genericType; - OType linkedOType = Type.getTypeByClass(genericClass); + Class genericClass = (Class) genericType; + OType linkedOType = OrientDBType.getTypeByClass(genericClass); if(linkedOType!=null){ this.linkedType = linkedOType.getIntValue(); }else{ diff --git a/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeDefinitionImpl.java deleted file mode 100644 index 276cd0d..0000000 --- a/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeDefinitionImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.gcube.informationsystem.types.impl.properties; - -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; - -import com.fasterxml.jackson.annotation.JsonTypeName; - -@JsonTypeName(value = PropertyTypeDefinition.NAME) -public final class PropertyTypeDefinitionImpl

extends TypeDefinitionImpl - implements PropertyTypeDefinition

{ - - /** - * Generated Serial Version UID - */ - private static final long serialVersionUID = 7532701373450638829L; - - protected PropertyTypeDefinitionImpl() { - super(); - } - - public PropertyTypeDefinitionImpl(Class

clz) { - super(clz); - this.superClasses = retrieveSuperClasses(clz, BaseProperty.class, - clz == BaseProperty.class ? null : BaseProperty.NAME); - } - -} \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeImpl.java new file mode 100644 index 0000000..bf12522 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/types/impl/properties/PropertyTypeImpl.java @@ -0,0 +1,28 @@ +package org.gcube.informationsystem.types.impl.properties; + +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; +import org.gcube.informationsystem.types.reference.properties.PropertyType; + +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeName(value = PropertyType.NAME) +public final class PropertyTypeImpl

extends TypeDefinitionImpl + implements PropertyType

{ + + /** + * Generated Serial Version UID + */ + private static final long serialVersionUID = 7532701373450638829L; + + protected PropertyTypeImpl() { + super(); + } + + public PropertyTypeImpl(Class

clz) { + super(clz); + this.superClasses = retrieveSuperClasses(clz, PropertyElement.class, + clz == PropertyElement.class ? null : PropertyElement.NAME); + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeImpl.java similarity index 73% rename from src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeImpl.java index d09e9e9..6a4021e 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/relations/ConsistsOfTypeImpl.java @@ -6,30 +6,30 @@ import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.Relation; -import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl; -import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; -import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; +import org.gcube.informationsystem.types.impl.entities.FacetTypeImpl; +import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl; +import org.gcube.informationsystem.types.reference.entities.FacetType; +import org.gcube.informationsystem.types.reference.entities.ResourceType; +import org.gcube.informationsystem.types.reference.relations.ConsistsOfType; import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=ConsistsOfTypeDefinition.NAME) -public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl implements ConsistsOfTypeDefinition { +@JsonTypeName(value=ConsistsOfType.NAME) +public class ConsistsOfTypeImpl extends RelationTypeImpl implements ConsistsOfType { /** * Generated Serial Version UID */ private static final long serialVersionUID = 2891976493165330476L; - protected ConsistsOfTypeDefinitionImpl() { + protected ConsistsOfTypeImpl() { super(); } - public ConsistsOfTypeDefinitionImpl(Class> clz) { + public ConsistsOfTypeImpl(Class> clz) { super(clz); this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME); @@ -54,7 +54,7 @@ public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl) getGenericClass(typeParameters[1]); } - this.source = new ResourceTypeDefinitionImpl((Class) sourceClass); - this.target = new FacetTypeDefinitionImpl((Class) targetClass); + this.source = new ResourceTypeImpl((Class) sourceClass); + this.target = new FacetTypeImpl((Class) targetClass); } } diff --git a/src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeImpl.java similarity index 72% rename from src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeImpl.java index 48ac7a2..2d452b0 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/relations/IsRelatedToTypeImpl.java @@ -5,28 +5,28 @@ import java.lang.reflect.Type; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.Relation; -import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; -import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; +import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl; +import org.gcube.informationsystem.types.reference.entities.ResourceType; +import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; import com.fasterxml.jackson.annotation.JsonTypeName; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonTypeName(value=IsRelatedToTypeDefinition.NAME) -public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl implements IsRelatedToTypeDefinition { +@JsonTypeName(value=IsRelatedToType.NAME) +public class IsRelatedToTypeImpl extends RelationTypeImpl implements IsRelatedToType { /** * Generated Serial Version UID */ private static final long serialVersionUID = 8448665395204514722L; - protected IsRelatedToTypeDefinitionImpl() { + protected IsRelatedToTypeImpl() { super(); } - public IsRelatedToTypeDefinitionImpl(Class> clz) { + public IsRelatedToTypeImpl(Class> clz) { super(clz); this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME); @@ -51,7 +51,7 @@ public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl) getGenericClass(typeParameters[1]); } - this.source = new ResourceTypeDefinitionImpl((Class) sourceClass); - this.target = new ResourceTypeDefinitionImpl((Class) targetClass); + this.source = new ResourceTypeImpl((Class) sourceClass); + this.target = new ResourceTypeImpl((Class) targetClass); } } diff --git a/src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeDefinitionImpl.java b/src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeImpl.java similarity index 57% rename from src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeDefinitionImpl.java rename to src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeImpl.java index f064a54..0f26c2e 100644 --- a/src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeDefinitionImpl.java +++ b/src/main/java/org/gcube/informationsystem/types/impl/relations/RelationTypeImpl.java @@ -3,60 +3,60 @@ package org.gcube.informationsystem.types.impl.relations; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; -import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; -import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; +import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl; +import org.gcube.informationsystem.types.reference.entities.EntityType; +import org.gcube.informationsystem.types.reference.relations.RelationType; import com.fasterxml.jackson.annotation.JsonTypeName; -@JsonTypeName(value = RelationTypeDefinition.NAME) -public class RelationTypeDefinitionImpl - extends TypeDefinitionImpl implements RelationTypeDefinition { +@JsonTypeName(value = RelationType.NAME) +public class RelationTypeImpl + extends TypeDefinitionImpl implements RelationType { /** * Generated Serial Version UID */ private static final long serialVersionUID = 2221831081869571296L; - protected RelationTypeDefinitionImpl() { + protected RelationTypeImpl() { super(); } - public static RelationTypeDefinition getRelationTypeDefinitionInstance( - Class> clz) { + public static RelationType getRelationTypeDefinitionInstance( + Class> clz) { if(IsRelatedTo.class.isAssignableFrom(clz)) { @SuppressWarnings("unchecked") Class> c = (Class>) clz; - return new IsRelatedToTypeDefinitionImpl(c); + return new IsRelatedToTypeImpl(c); } else if(ConsistsOf.class.isAssignableFrom(clz)) { @SuppressWarnings("unchecked") Class> c = (Class>) clz; - return new ConsistsOfTypeDefinitionImpl(c); + return new ConsistsOfTypeImpl(c); } - return new RelationTypeDefinitionImpl(clz); + return new RelationTypeImpl(clz); } - public RelationTypeDefinitionImpl(Class> clz) { + public RelationTypeImpl(Class> clz) { super(clz); - if(RelationTypeDefinition.class.isAssignableFrom(clz)) { + if(RelationType.class.isAssignableFrom(clz)) { @SuppressWarnings({"unchecked"}) - Class> c = (Class>) clz; - this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME); + Class> c = (Class>) clz; + this.superClasses = retrieveSuperClasses(c, RelationType.class, RelationElement.NAME); } else if(IsParentOf.class.isAssignableFrom(clz)) { @SuppressWarnings("unchecked") Class c = (Class) clz; - this.superClasses = retrieveSuperClasses(c, IsParentOf.class, BaseRelation.NAME); - } else if(BaseRelation.class.isAssignableFrom(clz)) { - this.superClasses = retrieveSuperClasses(clz, BaseRelation.class, null); + this.superClasses = retrieveSuperClasses(c, IsParentOf.class, RelationElement.NAME); + } else if(RelationElement.class.isAssignableFrom(clz)) { + this.superClasses = retrieveSuperClasses(clz, RelationElement.class, null); } else { throw new RuntimeException("Type Hierachy Error"); } @@ -66,36 +66,36 @@ public class RelationTypeDefinitionImpl> clz) { + protected Type[] getParametersFromSuperClasses(Class> clz) { for(Type t : clz.getGenericInterfaces()) { if(t instanceof ParameterizedType) { - if(BaseRelation.class.isAssignableFrom((Class) ((ParameterizedType) t).getRawType())) { + if(RelationElement.class.isAssignableFrom((Class) ((ParameterizedType) t).getRawType())) { return ((ParameterizedType) t).getActualTypeArguments(); } - } else if(BaseRelation.class.isAssignableFrom((Class) t)) { - return getParametersFromSuperClasses((Class>) t); + } else if(RelationElement.class.isAssignableFrom((Class) t)) { + return getParametersFromSuperClasses((Class>) t); } } throw new RuntimeException("Unable to find Generic Parameters From SuperClasses to set source and target"); } @SuppressWarnings("unchecked") - private void discoverSourceAndTarget(Class> clz) { + private void discoverSourceAndTarget(Class> clz) { Type[] typeParameters = clz.getTypeParameters(); - Class sourceClass; - Class targetClass; + Class sourceClass; + Class targetClass; if(typeParameters.length == 0) { typeParameters = getParametersFromSuperClasses(clz); - sourceClass = (Class) typeParameters[0]; - targetClass = (Class) typeParameters[1]; + sourceClass = (Class) typeParameters[0]; + targetClass = (Class) typeParameters[1]; } else { - sourceClass = (Class) getGenericClass(typeParameters[0]); - targetClass = (Class) getGenericClass(typeParameters[1]); + sourceClass = (Class) getGenericClass(typeParameters[0]); + targetClass = (Class) getGenericClass(typeParameters[1]); } - this.source = (S) new EntityTypeDefinitionImpl(sourceClass); - this.target = (T) new EntityTypeDefinitionImpl(targetClass); + this.source = (S) new EntityTypeImpl(sourceClass); + this.target = (T) new EntityTypeImpl(targetClass); } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java similarity index 83% rename from src/main/java/org/gcube/informationsystem/types/reference/entities/EntityTypeDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java index 94367cf..254c634 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityTypeDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/entities/EntityType.java @@ -2,9 +2,9 @@ package org.gcube.informationsystem.types.reference.entities; import java.util.Set; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; +import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl; import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; @@ -12,10 +12,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonIgnoreProperties(ignoreUnknown = true) -@JsonDeserialize(as = EntityTypeDefinitionImpl.class) -public interface EntityTypeDefinition extends TypeDefinition, BaseEntity { +@JsonDeserialize(as = EntityTypeImpl.class) +public interface EntityType extends TypeDefinition, EntityElement { - public static final String NAME = "EntityTypeDefinition"; //EntityTypeDefinition.class.getSimpleName(); + public static final String NAME = "EntityType"; //EntityType.class.getSimpleName(); /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ diff --git a/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetType.java b/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetType.java new file mode 100644 index 0000000..c84e455 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetType.java @@ -0,0 +1,15 @@ +package org.gcube.informationsystem.types.reference.entities; + +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.types.impl.entities.FacetTypeImpl; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonDeserialize(as = FacetTypeImpl.class) +public interface FacetType extends EntityType, EntityElement { + + public static final String NAME = "FacetType"; //FacetTypeDefinition.class.getSimpleName(); + +} diff --git a/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetTypeDefinition.java deleted file mode 100644 index f0beeeb..0000000 --- a/src/main/java/org/gcube/informationsystem/types/reference/entities/FacetTypeDefinition.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.gcube.informationsystem.types.reference.entities; - -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonDeserialize(as = FacetTypeDefinitionImpl.class) -public interface FacetTypeDefinition extends EntityTypeDefinition, BaseEntity { - - public static final String NAME = "FacetTypeDefinition"; //FacetTypeDefinition.class.getSimpleName(); - -} diff --git a/src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceType.java similarity index 61% rename from src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceTypeDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceType.java index 640df46..5a6d3d5 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceTypeDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/entities/ResourceType.java @@ -3,15 +3,15 @@ package org.gcube.informationsystem.types.reference.entities; import java.util.List; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; +import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl; +import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -@JsonDeserialize(as=ResourceTypeDefinitionImpl.class) -public interface ResourceTypeDefinition extends EntityTypeDefinition { +@JsonDeserialize(as=ResourceTypeImpl.class) +public interface ResourceType extends EntityType { - public static final String NAME = "ResourceTypeDefinition"; //ResourceTypeDefinition.class.getSimpleName(); + public static final String NAME = "ResourceType"; //ResourceType.class.getSimpleName(); public static final String DESCRIPTION = "Used to define a Resource Type"; public static final String VERSION = "1.0.0"; @@ -19,9 +19,9 @@ public interface ResourceTypeDefinition extends EntityTypeDefinition { public static final String RESOURCES_PROPERTY = "resources"; @ISProperty(name = FACETS_PROPERTY, readonly = false, mandatory = true, nullable = false) - public List getFacets(); + public List getFacets(); @ISProperty(name = RESOURCES_PROPERTY, readonly = false, mandatory = true, nullable = false) - public List getResources(); + public List getResources(); } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/properties/ResourceEntryDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java similarity index 79% rename from src/main/java/org/gcube/informationsystem/types/reference/properties/ResourceEntryDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java index d99e87d..0e36582 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/properties/ResourceEntryDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/properties/LinkedEntity.java @@ -1,15 +1,15 @@ package org.gcube.informationsystem.types.reference.properties; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.properties.ResourceEntryDefinitionImpl; +import org.gcube.informationsystem.types.impl.properties.LinkedEntityImpl; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -@JsonDeserialize(as=ResourceEntryDefinitionImpl.class) -public interface ResourceEntryDefinition extends BaseProperty { +@JsonDeserialize(as=LinkedEntityImpl.class) +public interface LinkedEntity extends PropertyElement { - public static final String NAME = "ResourceEntryDefinition"; // ResourceSchemaEntryDefinition.class.getSimpleName(); + public static final String NAME = "LinkedEntity"; // LinkedEntity.class.getSimpleName(); public static final String SOURCE_PROPERTY = "source"; public static final String RELATION_PROPERTY = "relation"; diff --git a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyDefinition.java index bcc5837..e4e5e50 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyDefinition.java @@ -1,6 +1,6 @@ package org.gcube.informationsystem.types.reference.properties; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonDeserialize(as = PropertyDefinitionImpl.class) -public interface PropertyDefinition extends BaseProperty { +public interface PropertyDefinition extends PropertyElement { public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName(); diff --git a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java similarity index 82% rename from src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyTypeDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java index e803c7a..a9fc929 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyTypeDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/properties/PropertyType.java @@ -3,20 +3,20 @@ package org.gcube.informationsystem.types.reference.properties; import java.util.Set; import org.gcube.informationsystem.base.reference.ER; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; +import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl; import org.gcube.informationsystem.types.reference.TypeDefinition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonIgnoreProperties(ignoreUnknown = true) -@JsonDeserialize(as = PropertyTypeDefinitionImpl.class) -public interface PropertyTypeDefinition

extends TypeDefinition, BaseProperty { +@JsonDeserialize(as = PropertyTypeImpl.class) +public interface PropertyType

extends TypeDefinition, PropertyElement { - public static final String NAME = "PropertyTypeDefinition"; // PropertyTypeDefinition.class.getSimpleName(); + public static final String NAME = "PropertyType"; // PropertyTypeDefinition.class.getSimpleName(); @ISProperty(name=ER.HEADER_PROPERTY, mandatory=true, nullable=false) public Header getHeader(); diff --git a/src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfType.java similarity index 51% rename from src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfTypeDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfType.java index 63188e8..e434e79 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfTypeDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/relations/ConsistsOfType.java @@ -1,17 +1,17 @@ package org.gcube.informationsystem.types.reference.relations; -import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; +import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeImpl; +import org.gcube.informationsystem.types.reference.entities.FacetType; +import org.gcube.informationsystem.types.reference.entities.ResourceType; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; /** * @author Luca Frosini (ISTI - CNR) */ -@JsonDeserialize(as = ConsistsOfTypeDefinitionImpl.class) -public interface ConsistsOfTypeDefinition extends RelationTypeDefinition { +@JsonDeserialize(as = ConsistsOfTypeImpl.class) +public interface ConsistsOfType extends RelationType { - public static final String NAME = "ConsistsOfTypeDefinition"; // ConsistsOfTypeDefinition.class.getSimpleName(); + public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName(); } diff --git a/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToType.java b/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToType.java new file mode 100644 index 0000000..8270668 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToType.java @@ -0,0 +1,16 @@ +package org.gcube.informationsystem.types.reference.relations; + +import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeImpl; +import org.gcube.informationsystem.types.reference.entities.ResourceType; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +@JsonDeserialize(as = IsRelatedToTypeImpl.class) +public interface IsRelatedToType extends RelationType { + + public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName(); + +} diff --git a/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToTypeDefinition.java deleted file mode 100644 index 576f4b0..0000000 --- a/src/main/java/org/gcube/informationsystem/types/reference/relations/IsRelatedToTypeDefinition.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.gcube.informationsystem.types.reference.relations; - -import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeDefinitionImpl; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -/** - * @author Luca Frosini (ISTI - CNR) - */ -@JsonDeserialize(as = IsRelatedToTypeDefinitionImpl.class) -public interface IsRelatedToTypeDefinition extends RelationTypeDefinition { - - public static final String NAME = "IsRelatedToTypeDefinition"; // IsRelatedToTypeDefinition.class.getSimpleName(); - -} diff --git a/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationTypeDefinition.java b/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java similarity index 81% rename from src/main/java/org/gcube/informationsystem/types/reference/relations/RelationTypeDefinition.java rename to src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java index 16af82b..bc4aa80 100644 --- a/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationTypeDefinition.java +++ b/src/main/java/org/gcube/informationsystem/types/reference/relations/RelationType.java @@ -2,22 +2,22 @@ package org.gcube.informationsystem.types.reference.relations; import java.util.Set; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.types.annotations.ISProperty; -import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl; +import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl; import org.gcube.informationsystem.types.reference.TypeDefinition; -import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; +import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonIgnoreProperties(ignoreUnknown = true) -@JsonDeserialize(as = RelationTypeDefinitionImpl.class) -public interface RelationTypeDefinition - extends TypeDefinition, BaseRelation { +@JsonDeserialize(as = RelationTypeImpl.class) +public interface RelationType + extends TypeDefinition, RelationElement { - public static final String NAME = "RelationTypeDefinition"; // RelationTypeDefinition.class.getSimpleName(); + public static final String NAME = "RelationType"; // RelationType.class.getSimpleName(); /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ diff --git a/src/main/java/org/gcube/informationsystem/utils/ERDeserializer.java b/src/main/java/org/gcube/informationsystem/utils/ElementDeserializer.java similarity index 93% rename from src/main/java/org/gcube/informationsystem/utils/ERDeserializer.java rename to src/main/java/org/gcube/informationsystem/utils/ElementDeserializer.java index 76bc262..bb5bc3d 100644 --- a/src/main/java/org/gcube/informationsystem/utils/ERDeserializer.java +++ b/src/main/java/org/gcube/informationsystem/utils/ElementDeserializer.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; import org.gcube.informationsystem.base.reference.AccessType; -import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.Element; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; @@ -29,13 +29,13 @@ import com.fasterxml.jackson.databind.node.TextNode; * @author Luca Frosini (ISTI - CNR) * */ -public class ERDeserializer extends StdDeserializer { +public class ElementDeserializer extends StdDeserializer { private static final long serialVersionUID = -2551569658316955137L; protected final ObjectMapper mapper; - public ERDeserializer(Class clz, ObjectMapper mapper) { + public ElementDeserializer(Class clz, ObjectMapper mapper) { super(clz); this.mapper = mapper; } @@ -60,7 +60,7 @@ public class ERDeserializer extends StdDeserializer extends StdDeserializer dummyClz = accessType.getDummyImplementationClass(); + Class dummyClz = accessType.getDummyImplementationClass(); if(dummyClz != null) { SimpleModule isModule = new SimpleModule(accessType.getName()); - isModule.addDeserializer(clz, new ERDeserializer<>(clz, mapper)); + isModule.addDeserializer(clz, new ElementDeserializer<>(clz, mapper)); mapper.registerModule(isModule); ISMapper.registerSubtypes(dummyClz); } @@ -97,7 +97,7 @@ public abstract class ISMapper { } - public static void registerSubtypes(Class... classes) { + public static void registerSubtypes(Class... classes) { mapper.registerSubtypes(classes); } @@ -111,7 +111,7 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws JsonGenerationException */ - public static T marshal(ISM object, T stream) + public static T marshal(ISM object, T stream) throws JsonGenerationException, JsonMappingException, IOException { mapper.writeValue(stream, object); return stream; @@ -125,7 +125,7 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws JsonGenerationException */ - public static T marshal(ISM object, T writer) + public static T marshal(ISM object, T writer) throws JsonGenerationException, JsonMappingException, IOException { mapper.writeValue(writer, object); return writer; @@ -137,7 +137,7 @@ public abstract class ISMapper { * @return the String serialization of a given resource * @throws JsonProcessingException */ - public static String marshal(ISM object) throws JsonProcessingException { + public static String marshal(ISM object) throws JsonProcessingException { return mapper.writeValueAsString(object); } @@ -147,8 +147,8 @@ public abstract class ISMapper { * @return the String serialization of a given list * @throws JsonProcessingException */ - public static String marshal(List list) throws JsonProcessingException { - JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, ISManageable.class); + public static String marshal(List list) throws JsonProcessingException { + JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, Element.class); return mapper.writerFor(type).writeValueAsString(list); } @@ -158,7 +158,7 @@ public abstract class ISMapper { * @return the String serialization of a given array * @throws JsonProcessingException */ - public static String marshal(ISM[] array) throws JsonProcessingException { + public static String marshal(ISM[] array) throws JsonProcessingException { return mapper.writeValueAsString(array); } @@ -172,7 +172,7 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws IOException */ - public static ISM unmarshal(Class clz, Reader reader) + public static ISM unmarshal(Class clz, Reader reader) throws JsonParseException, JsonMappingException, IOException { return mapper.readValue(reader, clz); } @@ -187,7 +187,7 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws JsonParseException */ - public static ISM unmarshal(Class clz, InputStream stream) + public static ISM unmarshal(Class clz, InputStream stream) throws JsonParseException, JsonMappingException, IOException { return mapper.readValue(stream, clz); } @@ -201,7 +201,7 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws IOException */ - public static ISM unmarshal(Class clz, String string) + public static ISM unmarshal(Class clz, String string) throws JsonParseException, JsonMappingException, IOException { return mapper.readValue(string, clz); } @@ -215,20 +215,20 @@ public abstract class ISMapper { * @throws JsonMappingException * @throws IOException */ - public static ISM unmarshalWithReader(Class clz, String string) + public static ISM unmarshalWithReader(Class clz, String string) throws JsonParseException, JsonMappingException, IOException { return mapper.readerFor(clz).readValue(string); } - public static List unmarshalList(Class clz, String string) + public static List unmarshalList(Class clz, String string) throws JsonParseException, JsonMappingException, IOException { JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, clz); return mapper.readValue(string, type); } - public static List unmarshalList(String string) + public static List unmarshalList(String string) throws JsonParseException, JsonMappingException, IOException { - JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, ISManageable.class); + JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, Element.class); return mapper.readValue(string, type); } diff --git a/src/main/java/org/gcube/informationsystem/utils/ISMappingAction.java b/src/main/java/org/gcube/informationsystem/utils/ISMappingAction.java index fc631b6..4964aa0 100644 --- a/src/main/java/org/gcube/informationsystem/utils/ISMappingAction.java +++ b/src/main/java/org/gcube/informationsystem/utils/ISMappingAction.java @@ -3,9 +3,9 @@ */ package org.gcube.informationsystem.utils; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.utils.discovery.SchemaAction; /** @@ -19,21 +19,21 @@ class ISMappingAction implements SchemaAction { @SuppressWarnings("unchecked") @Override - public

void managePropertyClass(Class

e) + public

void managePropertyClass(Class

e) throws Exception { ISMapper.registerSubtypes(e); } @SuppressWarnings("unchecked") @Override - public void manageEntityClass(Class e) + public void manageEntityClass(Class e) throws Exception { ISMapper.registerSubtypes(e); } @SuppressWarnings("unchecked") @Override - public > void manageRelationClass( + public > void manageRelationClass( Class r) throws Exception { ISMapper.registerSubtypes(r); } diff --git a/src/main/java/org/gcube/informationsystem/utils/discovery/ISMDiscovery.java b/src/main/java/org/gcube/informationsystem/utils/discovery/ISMDiscovery.java index bcbde6e..1481fd1 100644 --- a/src/main/java/org/gcube/informationsystem/utils/discovery/ISMDiscovery.java +++ b/src/main/java/org/gcube/informationsystem/utils/discovery/ISMDiscovery.java @@ -13,10 +13,10 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import org.gcube.informationsystem.base.reference.ISManageable; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.Element; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.types.annotations.ISProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class ISMDiscovery { +public class ISMDiscovery { private static Logger logger = LoggerFactory.getLogger(ISMDiscovery.class); @@ -81,7 +81,7 @@ public class ISMDiscovery { analizeISM(parent); } - if(root == BaseProperty.class) { + if(root == PropertyElement.class) { for(Method m : clz.getDeclaredMethods()) { m.setAccessible(true); @@ -92,7 +92,7 @@ public class ISMDiscovery { Type[] typeArguments = ((ParameterizedType) m.getGenericReturnType()).getActualTypeArguments(); for(Type t : typeArguments) { @SuppressWarnings("unchecked") - Class tClass = (Class) t; + Class tClass = (Class) t; if(root.isAssignableFrom(tClass)) { @SuppressWarnings("unchecked") Class type = (Class) tClass; @@ -134,23 +134,23 @@ public class ISMDiscovery { @SuppressWarnings("unchecked") public static void manageISM(SchemaAction schemaAction, Package... packages) throws Exception { - ISMDiscovery propertyDiscovery = new ISMDiscovery<>(BaseProperty.class); + ISMDiscovery propertyDiscovery = new ISMDiscovery<>(PropertyElement.class); if(Objects.nonNull(packages)) { Arrays.stream(packages).forEach(p -> propertyDiscovery.addPackage(p)); } propertyDiscovery.discover(); - for(Class property : propertyDiscovery.getDiscovered()) { + for(Class property : propertyDiscovery.getDiscovered()) { logger.trace("Going to manage : {}", property); schemaAction.managePropertyClass(property); } - ISMDiscovery entityDiscovery = new ISMDiscovery<>(BaseEntity.class); + ISMDiscovery entityDiscovery = new ISMDiscovery<>(EntityElement.class); if(Objects.nonNull(packages)) { Arrays.stream(packages).forEach(p -> entityDiscovery.addPackage(p)); } entityDiscovery.discover(); - for(Class entity : entityDiscovery.getDiscovered()) { + for(Class entity : entityDiscovery.getDiscovered()) { logger.trace("Going to manage : {}", entity); schemaAction.manageEntityClass(entity); /* @@ -161,13 +161,13 @@ public class ISMDiscovery { } @SuppressWarnings("rawtypes") - ISMDiscovery relationDiscovery = new ISMDiscovery(BaseRelation.class); + ISMDiscovery relationDiscovery = new ISMDiscovery(RelationElement.class); if(Objects.nonNull(packages)) Arrays.stream(packages).forEach(p -> relationDiscovery.addPackage(p)); relationDiscovery.discover(); for(@SuppressWarnings("rawtypes") - Class relation : relationDiscovery.getDiscovered()) { + Class relation : relationDiscovery.getDiscovered()) { logger.trace("Going to manage : {}", relation); schemaAction.manageRelationClass(relation); /* diff --git a/src/main/java/org/gcube/informationsystem/utils/discovery/SchemaAction.java b/src/main/java/org/gcube/informationsystem/utils/discovery/SchemaAction.java index 0e22813..cf12a3e 100644 --- a/src/main/java/org/gcube/informationsystem/utils/discovery/SchemaAction.java +++ b/src/main/java/org/gcube/informationsystem/utils/discovery/SchemaAction.java @@ -3,9 +3,9 @@ */ package org.gcube.informationsystem.utils.discovery; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.base.reference.relations.BaseRelation; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.base.reference.relations.RelationElement; /** * @author Luca Frosini (ISTI - CNR) @@ -13,10 +13,10 @@ import org.gcube.informationsystem.base.reference.relations.BaseRelation; */ public interface SchemaAction { - public

void managePropertyClass(Class

e) throws Exception; + public

void managePropertyClass(Class

e) throws Exception; - public void manageEntityClass(Class e) throws Exception; + public void manageEntityClass(Class e) throws Exception; - public > void manageRelationClass(Class r) throws Exception; + public > void manageRelationClass(Class r) throws Exception; } diff --git a/src/test/java/org/gcube/informationsystem/types/EntitySchemaDefinition.java b/src/test/java/org/gcube/informationsystem/types/EntitySchemaDefinition.java index c003c73..16ad5b5 100644 --- a/src/test/java/org/gcube/informationsystem/types/EntitySchemaDefinition.java +++ b/src/test/java/org/gcube/informationsystem/types/EntitySchemaDefinition.java @@ -3,8 +3,8 @@ */ package org.gcube.informationsystem.types; -import org.gcube.informationsystem.base.reference.ISManageable; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.Element; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; @@ -23,14 +23,14 @@ public class EntitySchemaDefinition { @Test public void test() throws Exception { - Class clz = Header.class; + Class clz = Header.class; String json = TypeBinder.serializeType(clz); logger.trace(json); } @Test public void testRelationSerialization() throws Exception { - Class clz = IsRelatedTo.class; + Class clz = IsRelatedTo.class; String json = TypeBinder.serializeType(clz); logger.trace(json); } diff --git a/src/test/java/org/gcube/informationsystem/types/SerializationTest.java b/src/test/java/org/gcube/informationsystem/types/SerializationTest.java index 8928257..0996bed 100644 --- a/src/test/java/org/gcube/informationsystem/types/SerializationTest.java +++ b/src/test/java/org/gcube/informationsystem/types/SerializationTest.java @@ -1,7 +1,7 @@ package org.gcube.informationsystem.types; -import org.gcube.informationsystem.base.reference.entities.BaseEntity; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.entities.EntityElement; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; @@ -17,15 +17,15 @@ import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.Relation; -import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; -import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; -import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; +import org.gcube.informationsystem.types.reference.entities.EntityType; +import org.gcube.informationsystem.types.reference.entities.FacetType; +import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; -import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; -import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; -import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; -import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; -import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; +import org.gcube.informationsystem.types.reference.properties.PropertyType; +import org.gcube.informationsystem.types.reference.properties.LinkedEntity; +import org.gcube.informationsystem.types.reference.relations.ConsistsOfType; +import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; +import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.utils.ISMapper; import org.junit.Test; import org.slf4j.Logger; @@ -44,97 +44,97 @@ public class SerializationTest { @Test public void makeTypeDefinition() throws Exception{ - EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class); + EntityType resourceTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(ResourceType.class); logger.info(ISMapper.marshal(resourceTypeDefinitionSelf)); } @Test public void testPropertyTypeDefinition() throws Exception{ @SuppressWarnings("unchecked") - PropertyTypeDefinition basePropertyTypeDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(BaseProperty.class); + PropertyType basePropertyTypeDefinition = (PropertyType) TypeBinder.createTypeDefinition(PropertyElement.class); logger.info(ISMapper.marshal(basePropertyTypeDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition propertyTypeDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(Property.class); + PropertyType propertyTypeDefinition = (PropertyType) TypeBinder.createTypeDefinition(Property.class); logger.info(ISMapper.marshal(propertyTypeDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition

headerTypeDefinition = (PropertyTypeDefinition
) TypeBinder.createTypeDefinition(Header.class); + PropertyType
headerTypeDefinition = (PropertyType
) TypeBinder.createTypeDefinition(Header.class); logger.info(ISMapper.marshal(headerTypeDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition propagationConstraintDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(PropagationConstraint.class); + PropertyType propagationConstraintDefinition = (PropertyType) TypeBinder.createTypeDefinition(PropagationConstraint.class); logger.info(ISMapper.marshal(propagationConstraintDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition encryptedTypeDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(Encrypted.class); + PropertyType encryptedTypeDefinition = (PropertyType) TypeBinder.createTypeDefinition(Encrypted.class); logger.info(ISMapper.marshal(encryptedTypeDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition propertyDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(PropertyDefinition.class); + PropertyType propertyDefinition = (PropertyType) TypeBinder.createTypeDefinition(PropertyDefinition.class); logger.info(ISMapper.marshal(propertyDefinition)); @SuppressWarnings("unchecked") - PropertyTypeDefinition resourceEntryDefinition = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(ResourceEntryDefinition.class); + PropertyType resourceEntryDefinition = (PropertyType) TypeBinder.createTypeDefinition(LinkedEntity.class); logger.info(ISMapper.marshal(resourceEntryDefinition)); } @Test public void testEntityTypeDefinition() throws Exception{ - EntityTypeDefinition baseEntityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(BaseEntity.class); + EntityType baseEntityTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(EntityElement.class); logger.info(ISMapper.marshal(baseEntityTypeDefinition)); - EntityTypeDefinition entityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Entity.class); + EntityType entityTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(Entity.class); logger.info(ISMapper.marshal(entityTypeDefinition)); - ResourceTypeDefinition resourceTypeDefinition = (ResourceTypeDefinition) TypeBinder.createTypeDefinition(Resource.class); + ResourceType resourceTypeDefinition = (ResourceType) TypeBinder.createTypeDefinition(Resource.class); logger.info(ISMapper.marshal(resourceTypeDefinition)); - FacetTypeDefinition facetTypeDefinition = (FacetTypeDefinition) TypeBinder.createTypeDefinition(Facet.class); + FacetType facetTypeDefinition = (FacetType) TypeBinder.createTypeDefinition(Facet.class); logger.info(ISMapper.marshal(facetTypeDefinition)); - EntityTypeDefinition contextTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Context.class); + EntityType contextTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(Context.class); logger.info(ISMapper.marshal(contextTypeDefinition)); - EntityTypeDefinition entityTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(EntityTypeDefinition.class); + EntityType entityTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(EntityType.class); logger.info(ISMapper.marshal(entityTypeDefinitionSelf)); - EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class); + EntityType resourceTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(ResourceType.class); logger.info(ISMapper.marshal(resourceTypeDefinitionSelf)); - EntityTypeDefinition facetTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(FacetTypeDefinition.class); + EntityType facetTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(FacetType.class); logger.info(ISMapper.marshal(facetTypeDefinitionSelf)); } @Test public void testRelationTypeDefinition() throws Exception{ @SuppressWarnings("unchecked") - RelationTypeDefinition relationTypeDefinition = (RelationTypeDefinition) TypeBinder.createTypeDefinition(Relation.class); + RelationType relationTypeDefinition = (RelationType) TypeBinder.createTypeDefinition(Relation.class); logger.info(ISMapper.marshal(relationTypeDefinition)); - IsRelatedToTypeDefinition isRelatedToTypeDefinition = (IsRelatedToTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class); + IsRelatedToType isRelatedToTypeDefinition = (IsRelatedToType) TypeBinder.createTypeDefinition(IsRelatedTo.class); logger.info(ISMapper.marshal(isRelatedToTypeDefinition)); - ConsistsOfTypeDefinition consistsOfTypeDefinition = (ConsistsOfTypeDefinition) TypeBinder.createTypeDefinition(ConsistsOf.class); + ConsistsOfType consistsOfTypeDefinition = (ConsistsOfType) TypeBinder.createTypeDefinition(ConsistsOf.class); logger.info(ISMapper.marshal(consistsOfTypeDefinition)); @SuppressWarnings("unchecked") - RelationTypeDefinition isParentOfTypeDefinition = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsParentOf.class); + RelationType isParentOfTypeDefinition = (RelationType) TypeBinder.createTypeDefinition(IsParentOf.class); logger.info(ISMapper.marshal(isParentOfTypeDefinition)); @SuppressWarnings("unchecked") - RelationTypeDefinition rtdSelf = (RelationTypeDefinition) TypeBinder.createTypeDefinition(RelationTypeDefinition.class); + RelationType rtdSelf = (RelationType) TypeBinder.createTypeDefinition(RelationType.class); logger.info(ISMapper.marshal(rtdSelf)); @SuppressWarnings("unchecked") - RelationTypeDefinition isRelatedToTypeDefinitionSelf = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedToTypeDefinition.class); + RelationType isRelatedToTypeDefinitionSelf = (RelationType) TypeBinder.createTypeDefinition(IsRelatedToType.class); logger.info(ISMapper.marshal(isRelatedToTypeDefinitionSelf)); @SuppressWarnings("unchecked") - RelationTypeDefinition consistsOfTypeDefinitionSelf = (RelationTypeDefinition) TypeBinder.createTypeDefinition(ConsistsOfTypeDefinition.class); + RelationType consistsOfTypeDefinitionSelf = (RelationType) TypeBinder.createTypeDefinition(ConsistsOfType.class); logger.info(ISMapper.marshal(consistsOfTypeDefinitionSelf)); } diff --git a/src/test/java/org/gcube/informationsystem/utils/discovery/ISMDiscoveryTest.java b/src/test/java/org/gcube/informationsystem/utils/discovery/ISMDiscoveryTest.java index 48d1761..66c8013 100644 --- a/src/test/java/org/gcube/informationsystem/utils/discovery/ISMDiscoveryTest.java +++ b/src/test/java/org/gcube/informationsystem/utils/discovery/ISMDiscoveryTest.java @@ -1,14 +1,14 @@ package org.gcube.informationsystem.utils.discovery; -import org.gcube.informationsystem.base.reference.properties.BaseProperty; -import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; +import org.gcube.informationsystem.base.reference.properties.PropertyElement; +import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.junit.Test; public class ISMDiscoveryTest { @Test public void testISMDIscovery() { - ISMDiscovery propertyDiscovery = new ISMDiscovery<>(BaseProperty.class); - propertyDiscovery.analizeISM(PropertyTypeDefinition.class); + ISMDiscovery propertyDiscovery = new ISMDiscovery<>(PropertyElement.class); + propertyDiscovery.analizeISM(PropertyType.class); } }