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
This commit is contained in:
Luca Frosini 2020-01-30 10:26:43 +01:00
parent 4bf95bc2ea
commit 05d6f6796d
55 changed files with 398 additions and 400 deletions

View File

@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=ER.NAME) @JsonTypeName(value=ER.NAME)
public abstract class ERImpl extends ISManageableImpl implements ER { public abstract class ERImpl extends ElementImpl implements ER {
/** /**
* Generated Serial Version UID * Generated Serial Version UID

View File

@ -5,21 +5,21 @@ package org.gcube.informationsystem.base.impl;
import java.io.StringWriter; import java.io.StringWriter;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* *
*/ */
public class ISManageableImpl implements ISManageable { public class ElementImpl implements Element {
/** /**
* *
*/ */
private static final long serialVersionUID = 7338083489551084860L; private static final long serialVersionUID = 7338083489551084860L;
public ISManageableImpl(){ public ElementImpl(){
} }

View File

@ -1,5 +0,0 @@
package org.gcube.informationsystem.base.impl.entities;
public class EImpl {
}

View File

@ -3,22 +3,22 @@ package org.gcube.informationsystem.base.impl.entities;
import java.io.StringWriter; import java.io.StringWriter;
import org.gcube.informationsystem.base.impl.ERImpl; 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.entities.Entity;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value=BaseEntity.NAME) @JsonTypeName(value=EntityElement.NAME)
public abstract class BaseEntityImpl extends ERImpl implements Entity { public abstract class EntityElementImpl extends ERImpl implements Entity {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = -4488771434017342703L; private static final long serialVersionUID = -4488771434017342703L;
protected BaseEntityImpl(){ protected EntityElementImpl(){
super(); super();
this.header = null; this.header = null;
} }

View File

@ -1,7 +1,7 @@
package org.gcube.informationsystem.base.impl.properties; package org.gcube.informationsystem.base.impl.properties;
import org.gcube.informationsystem.base.impl.ISManageableImpl; import org.gcube.informationsystem.base.impl.ElementImpl;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@ -9,15 +9,15 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=BaseProperty.NAME) @JsonTypeName(value=PropertyElement.NAME)
public class BasePropertyImpl extends ISManageableImpl implements Property { public class PropertyElementImpl extends ElementImpl implements Property {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 1396998430221747445L; private static final long serialVersionUID = 1396998430221747445L;
public BasePropertyImpl() { public PropertyElementImpl() {
super(); super();
} }

View File

@ -1,10 +1,13 @@
package org.gcube.informationsystem.base.impl.relations; package org.gcube.informationsystem.base.impl.relations;
import org.gcube.informationsystem.base.impl.ERImpl; 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.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
public abstract class BaseRelationImpl<S extends BaseEntity, T extends BaseEntity> extends ERImpl implements BaseRelation<S, T> { import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value=RelationElement.NAME)
public abstract class RelationElementImpl<S extends EntityElement, T extends EntityElement> extends ERImpl implements RelationElement<S, T> {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
@ -14,11 +17,11 @@ public abstract class BaseRelationImpl<S extends BaseEntity, T extends BaseEntit
protected S source; protected S source;
protected T target; protected T target;
protected BaseRelationImpl() { protected RelationElementImpl() {
super(); super();
} }
protected BaseRelationImpl(S source, T target) { protected RelationElementImpl(S source, T target) {
this(); this();
this.source = source; this.source = source;
this.target = target; this.target = target;

View File

@ -5,12 +5,12 @@ package org.gcube.informationsystem.base.reference;
import java.util.Arrays; import java.util.Arrays;
import org.gcube.informationsystem.base.impl.entities.BaseEntityImpl; import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
import org.gcube.informationsystem.base.impl.properties.BasePropertyImpl; import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
import org.gcube.informationsystem.base.impl.relations.BaseRelationImpl; import org.gcube.informationsystem.base.impl.relations.RelationElementImpl;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.context.impl.entities.ContextImpl; import org.gcube.informationsystem.context.impl.entities.ContextImpl;
import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl; import org.gcube.informationsystem.context.impl.relations.IsParentOfImpl;
import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
@ -34,14 +34,14 @@ import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
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.PropertyDefinitionImpl;
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
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 org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory;
*/ */
public enum AccessType { public enum AccessType {
BASE_PROPERTY(BaseProperty.class, BaseProperty.NAME, BasePropertyImpl.class, null), PROPERTY_ELEMENT(PropertyElement.class, PropertyElement.NAME, PropertyElementImpl.class, null),
PROPERTY(Property.class, Property.NAME, PropertyImpl.class, DummyProperty.class), PROPERTY(Property.class, Property.NAME, PropertyImpl.class, DummyProperty.class),
CONTEXT(Context.class, Context.NAME, ContextImpl.class, null), CONTEXT(Context.class, Context.NAME, ContextImpl.class, null),
@ -61,30 +61,30 @@ public enum AccessType {
PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null), PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null),
// TYPE_DEFINITION(TypeDefinition.class, TypeDefinition.NAME, TypeDefinitionImpl.class, null), // TYPE_DEFINITION(TypeDefinition.class, TypeDefinition.NAME, TypeDefinitionImpl.class, null),
PROPERTY_TYPE_DEFINITION(PropertyTypeDefinition.class, PropertyTypeDefinition.NAME, PropertyTypeDefinitionImpl.class, null), PROPERTY_TYPE(PropertyType.class, PropertyType.NAME, PropertyTypeImpl.class, null),
ENTITY_TYPE_DEFINITION(EntityTypeDefinition.class, EntityTypeDefinition.NAME, EntityTypeDefinitionImpl.class, null), ENTITY_TYPE(EntityType.class, EntityType.NAME, EntityTypeImpl.class, null),
RELATION_TYPE_DEFINITION(RelationTypeDefinition.class, RelationTypeDefinition.NAME, RelationTypeDefinitionImpl.class, null), RELATION_TYPE(RelationType.class, RelationType.NAME, RelationTypeImpl.class, null),
BASE_ENTITY(BaseEntity.class, BaseEntity.NAME, BaseEntityImpl.class, null), ENTITY_ELEMENT(EntityElement.class, EntityElement.NAME, EntityElementImpl.class, null),
ENTITY(Entity.class, Entity.NAME, EntityImpl.class, null), ENTITY(Entity.class, Entity.NAME, EntityImpl.class, null),
RESOURCE(Resource.class, Resource.NAME, ResourceImpl.class, DummyResource.class), RESOURCE(Resource.class, Resource.NAME, ResourceImpl.class, DummyResource.class),
FACET(Facet.class, Facet.NAME, FacetImpl.class, DummyFacet.class), FACET(Facet.class, Facet.NAME, FacetImpl.class, DummyFacet.class),
BASE_RELATION(BaseRelation.class, BaseRelation.NAME, BaseRelationImpl.class, null), RELATION_ELEMENT(RelationElement.class, RelationElement.NAME, RelationElementImpl.class, null),
RELATION(Relation.class, Relation.NAME, RelationImpl.class, null), RELATION(Relation.class, Relation.NAME, RelationImpl.class, null),
IS_RELATED_TO(IsRelatedTo.class, IsRelatedTo.NAME, IsRelatedToImpl.class, DummyIsRelatedTo.class), IS_RELATED_TO(IsRelatedTo.class, IsRelatedTo.NAME, IsRelatedToImpl.class, DummyIsRelatedTo.class),
CONSISTS_OF(ConsistsOf.class, ConsistsOf.NAME, ConsistsOfImpl.class, DummyConsistsOf.class); CONSISTS_OF(ConsistsOf.class, ConsistsOf.NAME, ConsistsOfImpl.class, DummyConsistsOf.class);
private static Logger logger = LoggerFactory.getLogger(AccessType.class); private static Logger logger = LoggerFactory.getLogger(AccessType.class);
private final Class<? extends ISManageable> clz; private final Class<? extends Element> clz;
private final Class<? extends ISManageable> implementationClass; private final Class<? extends Element> implementationClass;
private final Class<? extends ISManageable> dummyImplementationClass; private final Class<? extends Element> dummyImplementationClass;
private final String name; private final String name;
private final String lowerCaseFirstCharacter; private final String lowerCaseFirstCharacter;
<ISM extends ISManageable, ISMC extends ISM, ISMD extends ISMC> <ISM extends Element, ISMC extends ISM, ISMD extends ISMC>
AccessType(Class<ISM> clz, String name, Class<ISMC> implementationClass, Class<ISMD> dummyImplementationClass){ AccessType(Class<ISM> clz, String name, Class<ISMC> implementationClass, Class<ISMD> dummyImplementationClass){
this.clz = clz; this.clz = clz;
this.implementationClass = implementationClass; this.implementationClass = implementationClass;
@ -94,17 +94,17 @@ public enum AccessType {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <ISM extends ISManageable> Class<ISM> getTypeClass(){ public <ISM extends Element> Class<ISM> getTypeClass(){
return (Class<ISM>) clz; return (Class<ISM>) clz;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <ISM extends ISManageable, ISMC extends ISM> Class<ISMC> getImplementationClass() { public <ISM extends Element, ISMC extends ISM> Class<ISMC> getImplementationClass() {
return (Class<ISMC>) implementationClass; return (Class<ISMC>) implementationClass;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <ISM extends ISManageable, ISMC extends ISM, ISMD extends ISMC> Class<ISMD> getDummyImplementationClass() { public <ISM extends Element, ISMC extends ISM, ISMD extends ISMC> Class<ISMD> getDummyImplementationClass() {
return (Class<ISMD>) dummyImplementationClass; return (Class<ISMD>) dummyImplementationClass;
} }
@ -126,7 +126,7 @@ public enum AccessType {
AccessType[] accessTypes = AccessType.values(); AccessType[] accessTypes = AccessType.values();
for (AccessType accessType : accessTypes) { for (AccessType accessType : accessTypes) {
Class<? extends ISManageable> typeClass = accessType.getTypeClass(); Class<? extends Element> typeClass = accessType.getTypeClass();
if (typeClass.isAssignableFrom(clz)) { if (typeClass.isAssignableFrom(clz)) {
if(ret==null || ret.getTypeClass().isAssignableFrom(typeClass)){ if(ret==null || ret.getTypeClass().isAssignableFrom(typeClass)){
ret = accessType; ret = accessType;

View File

@ -11,7 +11,7 @@ import org.gcube.informationsystem.model.reference.properties.Header;
*/ */
// @JsonDeserialize(as=ERImpl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=ERImpl.class) Do not uncomment to manage subclasses
// @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = ER.HEADER_PROPERTY) // @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(); public static final String NAME = "ER"; //ER.class.getSimpleName();

View File

@ -13,10 +13,10 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@Abstract @Abstract
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = ISManageable.CLASS_PROPERTY) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = Element.CLASS_PROPERTY)
public interface ISManageable extends Serializable { 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"; public static final String CLASS_PROPERTY = "@class";

View File

@ -9,10 +9,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Abstract @Abstract
@JsonIgnoreProperties(ignoreUnknown=true) @JsonIgnoreProperties(ignoreUnknown=true)
//@JsonDeserialize(as=BaseEntityImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=EntityElementImpl.class) Do not uncomment to manage subclasses
public interface BaseEntity extends ER { 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 */ /* Overriding getHeader method to create Header property in type */
@ISProperty(name=HEADER_PROPERTY, mandatory=true, nullable=false) @ISProperty(name=HEADER_PROPERTY, mandatory=true, nullable=false)

View File

@ -1,16 +1,16 @@
package org.gcube.informationsystem.base.reference.properties; 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) * @author Luca Frosini (ISTI - CNR)
* Root Class for Property types. It creates a base common type, which is useful * Root Class for Property types. It creates a base common type, which is useful
* for management purpose. * for management purpose.
*/ */
// @JsonDeserialize(as=BasePropertympl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=PropertyElementmpl.class) Do not uncomment to manage subclasses
public interface BaseProperty extends ISManageable { 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 DESCRIPTION = "This is the very base class for Property";
public static final String VERSION = "1.0.0"; public static final String VERSION = "1.0.0";

View File

@ -1,7 +1,7 @@
package org.gcube.informationsystem.base.reference.relations; package org.gcube.informationsystem.base.reference.relations;
import org.gcube.informationsystem.base.reference.ER; 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.model.reference.properties.Header;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
@ -10,10 +10,10 @@ import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
@Abstract @Abstract
//@JsonDeserialize(as=BaseRelationImpl.class) Do not uncomment to manage subclasses //@JsonDeserialize(as=RelationElementImpl.class) Do not uncomment to manage subclasses
public interface BaseRelation<S extends BaseEntity, T extends BaseEntity> extends ER { public interface RelationElement<S extends EntityElement, T extends EntityElement> 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 SOURCE_PROPERTY = "source";
public static final String TARGET_PROPERTY = "target"; public static final String TARGET_PROPERTY = "target";

View File

@ -7,7 +7,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; 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.impl.relations.IsParentOfImpl;
import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
@ -22,7 +22,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=Context.NAME) @JsonTypeName(value=Context.NAME)
public final class ContextImpl extends BaseEntityImpl implements Context { public final class ContextImpl extends EntityElementImpl implements Context {
/** /**
* Generated Serial Version UID * Generated Serial Version UID

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.context.impl.relations; 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.entities.Context;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=IsParentOf.NAME) @JsonTypeName(value=IsParentOf.NAME)
public final class IsParentOfImpl extends BaseRelationImpl<Context, Context> implements IsParentOf { public final class IsParentOfImpl extends RelationElementImpl<Context, Context> implements IsParentOf {
/** /**
* *

View File

@ -6,7 +6,7 @@ package org.gcube.informationsystem.context.reference.entities;
import java.util.List; import java.util.List;
import java.util.UUID; 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.impl.entities.ContextImpl;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.reference.relations.Relation; 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 * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Context
*/ */
@JsonDeserialize(as = ContextImpl.class) @JsonDeserialize(as = ContextImpl.class)
public interface Context extends BaseEntity { public interface Context extends EntityElement {
public static final String NAME = "Context"; // Context.class.getSimpleName(); public static final String NAME = "Context"; // Context.class.getSimpleName();

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.context.reference.relations; 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.impl.relations.IsParentOfImpl;
import org.gcube.informationsystem.context.reference.entities.Context; 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 * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#isParentOf
*/ */
@JsonDeserialize(as = IsParentOfImpl.class) @JsonDeserialize(as = IsParentOfImpl.class)
public interface IsParentOf extends BaseRelation<Context,Context> { public interface IsParentOf extends RelationElement<Context,Context> {
public static final String NAME = "IsParentOf"; //IsParentOf.class.getSimpleName(); public static final String NAME = "IsParentOf"; //IsParentOf.class.getSimpleName();

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.model.impl.entities; 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 org.gcube.informationsystem.model.reference.entities.Entity;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=Entity.NAME) @JsonTypeName(value=Entity.NAME)
public abstract class EntityImpl extends BaseEntityImpl implements Entity { public abstract class EntityImpl extends EntityElementImpl implements Entity {
/** /**
* Generated Serial Version UID * Generated Serial Version UID

View File

@ -8,7 +8,7 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; 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.entities.Facet;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
@ -78,7 +78,7 @@ public abstract class FacetImpl extends EntityImpl implements Facet {
if(value instanceof Map<?,?>) { if(value instanceof Map<?,?>) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String,Object>) value; Map<String, Object> map = (Map<String,Object>) value;
if(map.containsKey(ISManageable.CLASS_PROPERTY)) { if(map.containsKey(Element.CLASS_PROPERTY)) {
String reserialized = ISMapper.getObjectMapper().writeValueAsString(map); String reserialized = ISMapper.getObjectMapper().writeValueAsString(map);
Property property = ISMapper.unmarshal(Property.class, reserialized); Property property = ISMapper.unmarshal(Property.class, reserialized);
value = property; value = property;

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.model.impl.properties; 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 org.gcube.informationsystem.model.reference.properties.Property;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=Property.NAME) @JsonTypeName(value=Property.NAME)
public class PropertyImpl extends ISManageableImpl implements Property { public class PropertyImpl extends PropertyElementImpl implements Property {
/** /**
* Generated Serial Version UID * Generated Serial Version UID

View File

@ -8,8 +8,8 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.impl.relations.BaseRelationImpl; import org.gcube.informationsystem.base.impl.relations.RelationElementImpl;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
*/ */
@JsonTypeName(value = Relation.NAME) @JsonTypeName(value = Relation.NAME)
public abstract class RelationImpl<S extends Resource, T extends Entity> public abstract class RelationImpl<S extends Resource, T extends Entity>
extends BaseRelationImpl<S,T> implements Relation<S, T> { extends RelationElementImpl<S,T> implements Relation<S, T> {
/** /**
* *
@ -106,7 +106,7 @@ public abstract class RelationImpl<S extends Resource, T extends Entity>
if(value instanceof Map<?,?>) { if(value instanceof Map<?,?>) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String,Object>) value; Map<String, Object> map = (Map<String,Object>) value;
if(map.containsKey(ISManageable.CLASS_PROPERTY)) { if(map.containsKey(Element.CLASS_PROPERTY)) {
String reserialized = ISMapper.getObjectMapper().writeValueAsString(map); String reserialized = ISMapper.getObjectMapper().writeValueAsString(map);
Property property = ISMapper.unmarshal(Property.class, reserialized); Property property = ISMapper.unmarshal(Property.class, reserialized);
value = property; value = property;

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.model.reference.entities; 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; import org.gcube.informationsystem.types.annotations.Abstract;
@ -13,7 +13,7 @@ import org.gcube.informationsystem.types.annotations.Abstract;
*/ */
@Abstract @Abstract
//@JsonDeserialize(as=EntityImpl.class) Do not uncomment to manage subclasses //@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(); public static final String NAME = "Entity"; //Entity.class.getSimpleName();

View File

@ -3,7 +3,7 @@
*/ */
package org.gcube.informationsystem.model.reference.properties; 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) * @author Luca Frosini (ISTI - CNR)
@ -12,7 +12,7 @@ import org.gcube.informationsystem.base.reference.properties.BaseProperty;
*/ */
// @JsonIgnoreProperties(ignoreUnknown=true) // @JsonIgnoreProperties(ignoreUnknown=true)
// @JsonDeserialize(as=PropertyImpl.class) Do not uncomment to manage subclasses // @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 NAME = "Property"; //Property.class.getSimpleName();
public static final String DESCRIPTION = "This is the base class for Property"; public static final String DESCRIPTION = "This is the base class for Property";

View File

@ -5,7 +5,7 @@ package org.gcube.informationsystem.model.reference.relations;
import java.util.Map; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
*/ */
@Abstract @Abstract
// @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses // @JsonDeserialize(as=RelationImpl.class) Do not uncomment to manage subclasses
public interface Relation<S extends Resource, T extends Entity> extends BaseRelation<S,T> { public interface Relation<S extends Resource, T extends Entity> extends RelationElement<S,T> {
public static final String NAME = "Relation"; //Relation.class.getSimpleName(); public static final String NAME = "Relation"; //Relation.class.getSimpleName();

View File

@ -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 * https://github.com/orientechnologies/orientdb/blob/master/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OType.java
* and adapted for gCube purpose. * and adapted for gCube purpose.
*/ */
public class Type { public class OrientDBType {
public enum OType { public enum OType {
BOOLEAN("Boolean", 0), BOOLEAN("Boolean", 0),

View File

@ -3,7 +3,7 @@ package org.gcube.informationsystem.types;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.List; 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.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
@ -20,7 +20,7 @@ public class TypeBinder {
return json; return json;
} }
public static <ISM extends ISManageable> String serializeType(Class<ISM> type) throws Exception{ public static <ISM extends Element> String serializeType(Class<ISM> type) throws Exception{
TypeDefinition typeDefinition = createTypeDefinition(type); TypeDefinition typeDefinition = createTypeDefinition(type);
return ISMapper.marshal(typeDefinition); return ISMapper.marshal(typeDefinition);
} }
@ -30,7 +30,7 @@ public class TypeBinder {
return readValue; return readValue;
} }
public static <ISM extends ISManageable> String serializeTypeDefinitions(List<TypeDefinition> typeDefinitions) throws Exception{ public static <ISM extends Element> String serializeTypeDefinitions(List<TypeDefinition> typeDefinitions) throws Exception{
String json = ISMapper.marshal(typeDefinitions); String json = ISMapper.marshal(typeDefinitions);
return json; return json;
@ -41,16 +41,16 @@ public class TypeBinder {
return list; return list;
} }
public static <ISM extends ISManageable> TypeDefinition createTypeDefinition(Class<ISM> clz) { public static <ISM extends Element> TypeDefinition createTypeDefinition(Class<ISM> clz) {
TypeDefinition typeDefinition = TypeDefinitionImpl.getInstance(clz); TypeDefinition typeDefinition = TypeDefinitionImpl.getInstance(clz);
return typeDefinition; return typeDefinition;
} }
public static String getType(Class<? extends ISManageable> clz){ public static String getType(Class<? extends Element> clz){
return getStaticStringFieldByName(clz, NAME, clz.getSimpleName()); return getStaticStringFieldByName(clz, NAME, clz.getSimpleName());
} }
public static String getStaticStringFieldByName(Class<? extends ISManageable> type, String fieldName, String defaultValue){ public static String getStaticStringFieldByName(Class<? extends Element> type, String fieldName, String defaultValue){
Field field; Field field;
try { try {
field = type.getDeclaredField(fieldName); field = type.getDeclaredField(fieldName);

View File

@ -7,18 +7,18 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.impl.ERImpl; import org.gcube.informationsystem.base.impl.ERImpl;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.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.PropertyDefinitionImpl;
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
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.TypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -48,7 +48,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
protected Set<PropertyDefinition> properties; protected Set<PropertyDefinition> properties;
protected <ISM extends ISManageable> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){ protected <ISM extends Element> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){
Set<String> interfaceList = new HashSet<>(); Set<String> interfaceList = new HashSet<>();
if(type==baseClass){ if(type==baseClass){
@ -67,7 +67,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends ISManageable> clz = (Class<? extends ISManageable>) interfaceClass; Class<? extends Element> clz = (Class<? extends Element>) interfaceClass;
interfaceList.add(TypeBinder.getType(clz)); interfaceList.add(TypeBinder.getType(clz));
} }
@ -104,17 +104,17 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
public static TypeDefinition getInstance(Class<? extends ISManageable> clz) { public static TypeDefinition getInstance(Class<? extends Element> clz) {
TypeDefinition typeDefinition = null; TypeDefinition typeDefinition = null;
try { try {
if(BaseEntity.class.isAssignableFrom(clz)) { if(EntityElement.class.isAssignableFrom(clz)) {
typeDefinition = EntityTypeDefinitionImpl.getEntityTypeDefinitionInstance((Class<? extends BaseEntity>) clz); typeDefinition = EntityTypeImpl.getEntityTypeDefinitionInstance((Class<? extends EntityElement>) clz);
return typeDefinition; return typeDefinition;
} else if(BaseRelation.class.isAssignableFrom(clz)){ } else if(RelationElement.class.isAssignableFrom(clz)){
typeDefinition = RelationTypeDefinitionImpl.getRelationTypeDefinitionInstance((Class<? extends BaseRelation<?,?>>) clz); typeDefinition = RelationTypeImpl.getRelationTypeDefinitionInstance((Class<? extends RelationElement<?,?>>) clz);
return typeDefinition; return typeDefinition;
} else if(BaseProperty.class.isAssignableFrom(clz)){ } else if(PropertyElement.class.isAssignableFrom(clz)){
typeDefinition = new PropertyTypeDefinitionImpl(clz); typeDefinition = new PropertyTypeImpl(clz);
return typeDefinition; return typeDefinition;
} else if(TypeDefinition.class.isAssignableFrom(clz)) { } else if(TypeDefinition.class.isAssignableFrom(clz)) {
typeDefinition = new TypeDefinitionImpl(clz); typeDefinition = new TypeDefinitionImpl(clz);
@ -131,7 +131,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
protected TypeDefinitionImpl() {} protected TypeDefinitionImpl() {}
protected TypeDefinitionImpl(Class<? extends ISManageable> clz) { protected TypeDefinitionImpl(Class<? extends Element> clz) {
this.name = TypeBinder.getType(clz); this.name = TypeBinder.getType(clz);
this.description = TypeBinder.getStaticStringFieldByName(clz, DESCRIPTION, ""); this.description = TypeBinder.getStaticStringFieldByName(clz, DESCRIPTION, "");
this.abstractType = false; this.abstractType = false;

View File

@ -2,13 +2,13 @@ package org.gcube.informationsystem.types.impl.entities;
import java.io.StringWriter; 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.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; 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 org.gcube.informationsystem.utils.ISMapper;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=EntityTypeDefinition.NAME) @JsonTypeName(value=EntityType.NAME)
public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements EntityTypeDefinition { public class EntityTypeImpl extends TypeDefinitionImpl implements EntityType {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
@ -26,37 +26,37 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti
// private static final String VERTEX_CLASS_NAME = "V"; // private static final String VERTEX_CLASS_NAME = "V";
public static EntityTypeDefinition getEntityTypeDefinitionInstance(Class<? extends BaseEntity> clz) { public static EntityType getEntityTypeDefinitionInstance(Class<? extends EntityElement> clz) {
if(Resource.class.isAssignableFrom(clz)) { if(Resource.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends Resource> c = (Class<? extends Resource>) clz; Class<? extends Resource> c = (Class<? extends Resource>) clz;
return new ResourceTypeDefinitionImpl((Class<? extends Resource>) c); return new ResourceTypeImpl((Class<? extends Resource>) c);
} else if(Facet.class.isAssignableFrom(clz)){ } else if(Facet.class.isAssignableFrom(clz)){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends Facet> c = (Class<? extends Facet>) clz; Class<? extends Facet> c = (Class<? extends Facet>) clz;
return new FacetTypeDefinitionImpl(c); return new FacetTypeImpl(c);
} }
return new EntityTypeDefinitionImpl(clz); return new EntityTypeImpl(clz);
} }
protected EntityTypeDefinitionImpl() { protected EntityTypeImpl() {
super(); super();
} }
public EntityTypeDefinitionImpl(Class<? extends BaseEntity> clz) { public EntityTypeImpl(Class<? extends EntityElement> clz) {
super(clz); super(clz);
if(EntityTypeDefinition.class.isAssignableFrom(clz)){ if(EntityType.class.isAssignableFrom(clz)){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends EntityTypeDefinition> c = (Class<? extends EntityTypeDefinition>) clz; Class<? extends EntityType> c = (Class<? extends EntityType>) clz;
this.superClasses = retrieveSuperClasses(c, EntityTypeDefinition.class, BaseEntity.NAME); this.superClasses = retrieveSuperClasses(c, EntityType.class, EntityElement.NAME);
} else if(Context.class.isAssignableFrom(clz)){ } else if(Context.class.isAssignableFrom(clz)){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends Context> c = (Class<? extends Context>) clz; Class<? extends Context> c = (Class<? extends Context>) clz;
this.superClasses = retrieveSuperClasses(c, Context.class, BaseEntity.NAME); this.superClasses = retrieveSuperClasses(c, Context.class, EntityElement.NAME);
} else if(BaseEntity.class.isAssignableFrom(clz)){ } else if(EntityElement.class.isAssignableFrom(clz)){
this.superClasses = retrieveSuperClasses(clz, BaseEntity.class, null); this.superClasses = retrieveSuperClasses(clz, EntityElement.class, null);
} else { } else {
throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName()); throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName());
} }

View File

@ -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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; 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; import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=FacetTypeDefinition.NAME) @JsonTypeName(value=FacetType.NAME)
public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements FacetTypeDefinition { public class FacetTypeImpl extends EntityTypeImpl implements FacetType {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 6268161046955738969L; private static final long serialVersionUID = 6268161046955738969L;
protected FacetTypeDefinitionImpl() { protected FacetTypeImpl() {
super(); super();
} }
public FacetTypeDefinitionImpl(Class<? extends Facet> clz) { public FacetTypeImpl(Class<? extends Facet> clz) {
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME); this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME);

View File

@ -9,31 +9,31 @@ import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.annotations.ResourceSchema; import org.gcube.informationsystem.types.annotations.ResourceSchema;
import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry; import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry;
import org.gcube.informationsystem.types.annotations.ResourceSchemaRelatedEntry; import org.gcube.informationsystem.types.annotations.ResourceSchemaRelatedEntry;
import org.gcube.informationsystem.types.impl.properties.ResourceEntryDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.LinkedEntityImpl;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=ResourceTypeDefinition.NAME) @JsonTypeName(value=ResourceType.NAME)
public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl implements ResourceTypeDefinition { public class ResourceTypeImpl extends EntityTypeImpl implements ResourceType {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = -5964819173421808432L; private static final long serialVersionUID = -5964819173421808432L;
protected List<ResourceEntryDefinition> facets; protected List<LinkedEntity> facets;
protected List<ResourceEntryDefinition> resources; protected List<LinkedEntity> resources;
protected ResourceTypeDefinitionImpl() { protected ResourceTypeImpl() {
super(); super();
} }
public ResourceTypeDefinitionImpl(Class<? extends Resource> clz) { public ResourceTypeImpl(Class<? extends Resource> clz) {
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME); this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
@ -47,7 +47,7 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme
this.resources = new ArrayList<>(); this.resources = new ArrayList<>();
ResourceSchema[] resourceSchemaArray = clz.getAnnotationsByType(ResourceSchema.class); ResourceSchema[] resourceSchemaArray = clz.getAnnotationsByType(ResourceSchema.class);
for(ResourceSchemaEntry resourceSchemaEntry : resourceSchemaArray[0].facets()) { for(ResourceSchemaEntry resourceSchemaEntry : resourceSchemaArray[0].facets()) {
ResourceEntryDefinitionImpl resourceSchemaEntryDefinition = new ResourceEntryDefinitionImpl(); LinkedEntityImpl resourceSchemaEntryDefinition = new LinkedEntityImpl();
resourceSchemaEntryDefinition.setSource(TypeBinder.getType(clz)); resourceSchemaEntryDefinition.setSource(TypeBinder.getType(clz));
resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaEntry.relation())); resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaEntry.relation()));
resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaEntry.facet())); resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaEntry.facet()));
@ -57,7 +57,7 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme
this.facets.add(resourceSchemaEntryDefinition); this.facets.add(resourceSchemaEntryDefinition);
} }
for(ResourceSchemaRelatedEntry resourceSchemaRelatedEntry : resourceSchemaArray[0].resources()) { for(ResourceSchemaRelatedEntry resourceSchemaRelatedEntry : resourceSchemaArray[0].resources()) {
ResourceEntryDefinition resourceSchemaEntryDefinition = new ResourceEntryDefinitionImpl(); LinkedEntity resourceSchemaEntryDefinition = new LinkedEntityImpl();
resourceSchemaEntryDefinition.setSource(TypeBinder.getType(resourceSchemaRelatedEntry.source())); resourceSchemaEntryDefinition.setSource(TypeBinder.getType(resourceSchemaRelatedEntry.source()));
resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaRelatedEntry.relation())); resourceSchemaEntryDefinition.setRelation(TypeBinder.getType(resourceSchemaRelatedEntry.relation()));
resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaRelatedEntry.target())); resourceSchemaEntryDefinition.setTarget(TypeBinder.getType(resourceSchemaRelatedEntry.target()));
@ -70,12 +70,12 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme
} }
@Override @Override
public List<ResourceEntryDefinition> getFacets() { public List<LinkedEntity> getFacets() {
return facets; return facets;
} }
@Override @Override
public List<ResourceEntryDefinition> getResources() { public List<LinkedEntity> getResources() {
return resources; return resources;
} }

View File

@ -3,16 +3,16 @@
*/ */
package org.gcube.informationsystem.types.impl.properties; package org.gcube.informationsystem.types.impl.properties;
import org.gcube.informationsystem.base.impl.properties.BasePropertyImpl; import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=ResourceEntryDefinition.NAME) @JsonTypeName(value=LinkedEntity.NAME)
public final class ResourceEntryDefinitionImpl extends BasePropertyImpl implements ResourceEntryDefinition { public final class LinkedEntityImpl extends PropertyElementImpl implements LinkedEntity {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
@ -26,7 +26,7 @@ public final class ResourceEntryDefinitionImpl extends BasePropertyImpl implemen
protected Integer min; protected Integer min;
protected Integer max; protected Integer max;
public ResourceEntryDefinitionImpl() { public LinkedEntityImpl() {
super(); super();
} }

View File

@ -6,10 +6,10 @@ import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.types.Type; import org.gcube.informationsystem.types.OrientDBType;
import org.gcube.informationsystem.types.Type.OType; import org.gcube.informationsystem.types.OrientDBType.OType;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; 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()); logger.trace("Looking for property type {}", method.getReturnType());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends ISManageable> type = (Class<? extends ISManageable>) method.getReturnType(); Class<? extends Element> type = (Class<? extends Element>) method.getReturnType();
this.type = OType.PROPERTY.getIntValue(); this.type = OType.PROPERTY.getIntValue();
if(BaseProperty.class.isAssignableFrom(type)){ if(PropertyElement.class.isAssignableFrom(type)){
if(type != BaseProperty.class){ if(type != PropertyElement.class){
this.linkedClass = TypeBinder.getType(type); this.linkedClass = TypeBinder.getType(type);
} }
}else if (Type.getTypeByClass(type)!=null) { }else if (OrientDBType.getTypeByClass(type)!=null) {
this.type = Type.getTypeByClass(type).getIntValue(); this.type = OrientDBType.getTypeByClass(type).getIntValue();
if(this.type > 9 && this.type <= 12){ if(this.type > 9 && this.type <= 12){
java.lang.reflect.Type genericReturnType = method.getGenericReturnType(); java.lang.reflect.Type genericReturnType = method.getGenericReturnType();
logger.trace("Generic Return Type {} for method {}", genericReturnType, method); logger.trace("Generic Return Type {} for method {}", genericReturnType, method);
@ -103,8 +103,8 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends ISManageable> genericClass = (Class<? extends ISManageable>) genericType; Class<? extends Element> genericClass = (Class<? extends Element>) genericType;
OType linkedOType = Type.getTypeByClass(genericClass); OType linkedOType = OrientDBType.getTypeByClass(genericClass);
if(linkedOType!=null){ if(linkedOType!=null){
this.linkedType = linkedOType.getIntValue(); this.linkedType = linkedOType.getIntValue();
}else{ }else{

View File

@ -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<P extends BaseProperty> extends TypeDefinitionImpl
implements PropertyTypeDefinition<P> {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 7532701373450638829L;
protected PropertyTypeDefinitionImpl() {
super();
}
public PropertyTypeDefinitionImpl(Class<P> clz) {
super(clz);
this.superClasses = retrieveSuperClasses(clz, BaseProperty.class,
clz == BaseProperty.class ? null : BaseProperty.NAME);
}
}

View File

@ -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<P extends PropertyElement> extends TypeDefinitionImpl
implements PropertyType<P> {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 7532701373450638829L;
protected PropertyTypeImpl() {
super();
}
public PropertyTypeImpl(Class<P> clz) {
super(clz);
this.superClasses = retrieveSuperClasses(clz, PropertyElement.class,
clz == PropertyElement.class ? null : PropertyElement.NAME);
}
}

View File

@ -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.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.FacetTypeImpl;
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=ConsistsOfTypeDefinition.NAME) @JsonTypeName(value=ConsistsOfType.NAME)
public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, FacetTypeDefinition> implements ConsistsOfTypeDefinition { public class ConsistsOfTypeImpl extends RelationTypeImpl<ResourceType, FacetType> implements ConsistsOfType {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2891976493165330476L; private static final long serialVersionUID = 2891976493165330476L;
protected ConsistsOfTypeDefinitionImpl() { protected ConsistsOfTypeImpl() {
super(); super();
} }
public ConsistsOfTypeDefinitionImpl(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) { public ConsistsOfTypeImpl(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME); this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
@ -54,7 +54,7 @@ public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl<Res
targetClass = (Class<? extends Facet>) getGenericClass(typeParameters[1]); targetClass = (Class<? extends Facet>) getGenericClass(typeParameters[1]);
} }
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass); this.source = new ResourceTypeImpl((Class<? extends Resource>) sourceClass);
this.target = new FacetTypeDefinitionImpl((Class<? extends Facet>) targetClass); this.target = new FacetTypeImpl((Class<? extends Facet>) targetClass);
} }
} }

View File

@ -5,28 +5,28 @@ import java.lang.reflect.Type;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=IsRelatedToTypeDefinition.NAME) @JsonTypeName(value=IsRelatedToType.NAME)
public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, ResourceTypeDefinition> implements IsRelatedToTypeDefinition { public class IsRelatedToTypeImpl extends RelationTypeImpl<ResourceType, ResourceType> implements IsRelatedToType {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 8448665395204514722L; private static final long serialVersionUID = 8448665395204514722L;
protected IsRelatedToTypeDefinitionImpl() { protected IsRelatedToTypeImpl() {
super(); super();
} }
public IsRelatedToTypeDefinitionImpl(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) { public IsRelatedToTypeImpl(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME); this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
@ -51,7 +51,7 @@ public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl<Re
targetClass = (Class<? extends Resource>) getGenericClass(typeParameters[1]); targetClass = (Class<? extends Resource>) getGenericClass(typeParameters[1]);
} }
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass); this.source = new ResourceTypeImpl((Class<? extends Resource>) sourceClass);
this.target = new ResourceTypeDefinitionImpl((Class<? extends Resource>) targetClass); this.target = new ResourceTypeImpl((Class<? extends Resource>) targetClass);
} }
} }

View File

@ -3,60 +3,60 @@ package org.gcube.informationsystem.types.impl.relations;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value = RelationTypeDefinition.NAME) @JsonTypeName(value = RelationType.NAME)
public class RelationTypeDefinitionImpl<S extends EntityTypeDefinition, T extends EntityTypeDefinition> public class RelationTypeImpl<S extends EntityType, T extends EntityType>
extends TypeDefinitionImpl implements RelationTypeDefinition<S,T> { extends TypeDefinitionImpl implements RelationType<S,T> {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2221831081869571296L; private static final long serialVersionUID = 2221831081869571296L;
protected RelationTypeDefinitionImpl() { protected RelationTypeImpl() {
super(); super();
} }
public static RelationTypeDefinition<?,?> getRelationTypeDefinitionInstance( public static RelationType<?,?> getRelationTypeDefinitionInstance(
Class<? extends BaseRelation<?,?>> clz) { Class<? extends RelationElement<?,?>> clz) {
if(IsRelatedTo.class.isAssignableFrom(clz)) { if(IsRelatedTo.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends IsRelatedTo<? extends Resource,? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource,? extends Resource>>) clz; Class<? extends IsRelatedTo<? extends Resource,? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource,? extends Resource>>) clz;
return new IsRelatedToTypeDefinitionImpl(c); return new IsRelatedToTypeImpl(c);
} else if(ConsistsOf.class.isAssignableFrom(clz)) { } else if(ConsistsOf.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends ConsistsOf<? extends Resource,? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource,? extends Facet>>) clz; Class<? extends ConsistsOf<? extends Resource,? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource,? extends Facet>>) clz;
return new ConsistsOfTypeDefinitionImpl(c); return new ConsistsOfTypeImpl(c);
} }
return new RelationTypeDefinitionImpl<EntityTypeDefinition,EntityTypeDefinition>(clz); return new RelationTypeImpl<EntityType,EntityType>(clz);
} }
public RelationTypeDefinitionImpl(Class<? extends BaseRelation<?,?>> clz) { public RelationTypeImpl(Class<? extends RelationElement<?,?>> clz) {
super(clz); super(clz);
if(RelationTypeDefinition.class.isAssignableFrom(clz)) { if(RelationType.class.isAssignableFrom(clz)) {
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked"})
Class<RelationTypeDefinition<?,?>> c = (Class<RelationTypeDefinition<?,?>>) clz; Class<RelationType<?,?>> c = (Class<RelationType<?,?>>) clz;
this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME); this.superClasses = retrieveSuperClasses(c, RelationType.class, RelationElement.NAME);
} else if(IsParentOf.class.isAssignableFrom(clz)) { } else if(IsParentOf.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends IsParentOf> c = (Class<? extends IsParentOf>) clz; Class<? extends IsParentOf> c = (Class<? extends IsParentOf>) clz;
this.superClasses = retrieveSuperClasses(c, IsParentOf.class, BaseRelation.NAME); this.superClasses = retrieveSuperClasses(c, IsParentOf.class, RelationElement.NAME);
} else if(BaseRelation.class.isAssignableFrom(clz)) { } else if(RelationElement.class.isAssignableFrom(clz)) {
this.superClasses = retrieveSuperClasses(clz, BaseRelation.class, null); this.superClasses = retrieveSuperClasses(clz, RelationElement.class, null);
} else { } else {
throw new RuntimeException("Type Hierachy Error"); throw new RuntimeException("Type Hierachy Error");
} }
@ -66,36 +66,36 @@ public class RelationTypeDefinitionImpl<S extends EntityTypeDefinition, T extend
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected Type[] getParametersFromSuperClasses(Class<? extends BaseRelation<?,?>> clz) { protected Type[] getParametersFromSuperClasses(Class<? extends RelationElement<?,?>> clz) {
for(Type t : clz.getGenericInterfaces()) { for(Type t : clz.getGenericInterfaces()) {
if(t instanceof ParameterizedType) { if(t instanceof ParameterizedType) {
if(BaseRelation.class.isAssignableFrom((Class<?>) ((ParameterizedType) t).getRawType())) { if(RelationElement.class.isAssignableFrom((Class<?>) ((ParameterizedType) t).getRawType())) {
return ((ParameterizedType) t).getActualTypeArguments(); return ((ParameterizedType) t).getActualTypeArguments();
} }
} else if(BaseRelation.class.isAssignableFrom((Class<?>) t)) { } else if(RelationElement.class.isAssignableFrom((Class<?>) t)) {
return getParametersFromSuperClasses((Class<? extends BaseRelation<?,?>>) t); return getParametersFromSuperClasses((Class<? extends RelationElement<?,?>>) t);
} }
} }
throw new RuntimeException("Unable to find Generic Parameters From SuperClasses to set source and target"); throw new RuntimeException("Unable to find Generic Parameters From SuperClasses to set source and target");
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void discoverSourceAndTarget(Class<? extends BaseRelation<?,?>> clz) { private void discoverSourceAndTarget(Class<? extends RelationElement<?,?>> clz) {
Type[] typeParameters = clz.getTypeParameters(); Type[] typeParameters = clz.getTypeParameters();
Class<? extends BaseEntity> sourceClass; Class<? extends EntityElement> sourceClass;
Class<? extends BaseEntity> targetClass; Class<? extends EntityElement> targetClass;
if(typeParameters.length == 0) { if(typeParameters.length == 0) {
typeParameters = getParametersFromSuperClasses(clz); typeParameters = getParametersFromSuperClasses(clz);
sourceClass = (Class<? extends BaseEntity>) typeParameters[0]; sourceClass = (Class<? extends EntityElement>) typeParameters[0];
targetClass = (Class<? extends BaseEntity>) typeParameters[1]; targetClass = (Class<? extends EntityElement>) typeParameters[1];
} else { } else {
sourceClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[0]); sourceClass = (Class<? extends EntityElement>) getGenericClass(typeParameters[0]);
targetClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[1]); targetClass = (Class<? extends EntityElement>) getGenericClass(typeParameters[1]);
} }
this.source = (S) new EntityTypeDefinitionImpl(sourceClass); this.source = (S) new EntityTypeImpl(sourceClass);
this.target = (T) new EntityTypeDefinitionImpl(targetClass); this.target = (T) new EntityTypeImpl(targetClass);
} }

View File

@ -2,9 +2,9 @@ package org.gcube.informationsystem.types.reference.entities;
import java.util.Set; 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.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.TypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; 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; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = EntityTypeDefinitionImpl.class) @JsonDeserialize(as = EntityTypeImpl.class)
public interface EntityTypeDefinition extends TypeDefinition, BaseEntity { 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 */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */

View File

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

View File

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

View File

@ -3,15 +3,15 @@ package org.gcube.informationsystem.types.reference.entities;
import java.util.List; import java.util.List;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonDeserialize(as=ResourceTypeDefinitionImpl.class) @JsonDeserialize(as=ResourceTypeImpl.class)
public interface ResourceTypeDefinition extends EntityTypeDefinition { 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 DESCRIPTION = "Used to define a Resource Type";
public static final String VERSION = "1.0.0"; public static final String VERSION = "1.0.0";
@ -19,9 +19,9 @@ public interface ResourceTypeDefinition extends EntityTypeDefinition {
public static final String RESOURCES_PROPERTY = "resources"; public static final String RESOURCES_PROPERTY = "resources";
@ISProperty(name = FACETS_PROPERTY, readonly = false, mandatory = true, nullable = false) @ISProperty(name = FACETS_PROPERTY, readonly = false, mandatory = true, nullable = false)
public List<ResourceEntryDefinition> getFacets(); public List<LinkedEntity> getFacets();
@ISProperty(name = RESOURCES_PROPERTY, readonly = false, mandatory = true, nullable = false) @ISProperty(name = RESOURCES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public List<ResourceEntryDefinition> getResources(); public List<LinkedEntity> getResources();
} }

View File

@ -1,15 +1,15 @@
package org.gcube.informationsystem.types.reference.properties; 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.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; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonDeserialize(as=ResourceEntryDefinitionImpl.class) @JsonDeserialize(as=LinkedEntityImpl.class)
public interface ResourceEntryDefinition extends BaseProperty { 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 SOURCE_PROPERTY = "source";
public static final String RELATION_PROPERTY = "relation"; public static final String RELATION_PROPERTY = "relation";

View File

@ -1,6 +1,6 @@
package org.gcube.informationsystem.types.reference.properties; 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.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyDefinitionImpl.class) @JsonDeserialize(as = PropertyDefinitionImpl.class)
public interface PropertyDefinition extends BaseProperty { public interface PropertyDefinition extends PropertyElement {
public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName(); public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName();

View File

@ -3,20 +3,20 @@ package org.gcube.informationsystem.types.reference.properties;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.reference.ER; 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.model.reference.properties.Header;
import org.gcube.informationsystem.types.annotations.ISProperty; 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 org.gcube.informationsystem.types.reference.TypeDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyTypeDefinitionImpl.class) @JsonDeserialize(as = PropertyTypeImpl.class)
public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefinition, BaseProperty { public interface PropertyType<P extends PropertyElement> 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) @ISProperty(name=ER.HEADER_PROPERTY, mandatory=true, nullable=false)
public Header getHeader(); public Header getHeader();

View File

@ -1,17 +1,17 @@
package org.gcube.informationsystem.types.reference.relations; package org.gcube.informationsystem.types.reference.relations;
import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeImpl;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as = ConsistsOfTypeDefinitionImpl.class) @JsonDeserialize(as = ConsistsOfTypeImpl.class)
public interface ConsistsOfTypeDefinition extends RelationTypeDefinition<ResourceTypeDefinition, FacetTypeDefinition> { public interface ConsistsOfType extends RelationType<ResourceType, FacetType> {
public static final String NAME = "ConsistsOfTypeDefinition"; // ConsistsOfTypeDefinition.class.getSimpleName(); public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName();
} }

View File

@ -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<ResourceType, ResourceType> {
public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName();
}

View File

@ -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<ResourceTypeDefinition, ResourceTypeDefinition> {
public static final String NAME = "IsRelatedToTypeDefinition"; // IsRelatedToTypeDefinition.class.getSimpleName();
}

View File

@ -2,22 +2,22 @@ package org.gcube.informationsystem.types.reference.relations;
import java.util.Set; 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.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.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 org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = RelationTypeDefinitionImpl.class) @JsonDeserialize(as = RelationTypeImpl.class)
public interface RelationTypeDefinition<S extends EntityTypeDefinition, T extends EntityTypeDefinition> public interface RelationType<S extends EntityType, T extends EntityType>
extends TypeDefinition, BaseRelation<S,T> { extends TypeDefinition, RelationElement<S,T> {
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 */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */

View File

@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.informationsystem.base.reference.AccessType; 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.JsonFactory;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
@ -29,13 +29,13 @@ import com.fasterxml.jackson.databind.node.TextNode;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* *
*/ */
public class ERDeserializer<ISM extends ISManageable> extends StdDeserializer<ISM> { public class ElementDeserializer<ISM extends Element> extends StdDeserializer<ISM> {
private static final long serialVersionUID = -2551569658316955137L; private static final long serialVersionUID = -2551569658316955137L;
protected final ObjectMapper mapper; protected final ObjectMapper mapper;
public ERDeserializer(Class<ISM> clz, ObjectMapper mapper) { public ElementDeserializer(Class<ISM> clz, ObjectMapper mapper) {
super(clz); super(clz);
this.mapper = mapper; this.mapper = mapper;
} }
@ -60,7 +60,7 @@ public class ERDeserializer<ISM extends ISManageable> extends StdDeserializer<IS
try { try {
JsonNode superClassesTreeNode = objectNode JsonNode superClassesTreeNode = objectNode
.get(ISManageable.SUPERCLASSES_PROPERTY); .get(Element.SUPERCLASSES_PROPERTY);
if (superClassesTreeNode != null if (superClassesTreeNode != null
&& superClassesTreeNode.isArray()) { && superClassesTreeNode.isArray()) {
ArrayNode arrayNode = (ArrayNode) superClassesTreeNode; ArrayNode arrayNode = (ArrayNode) superClassesTreeNode;
@ -117,7 +117,7 @@ public class ERDeserializer<ISM extends ISManageable> extends StdDeserializer<IS
// No suitable class found Using Dummy Implementation // No suitable class found Using Dummy Implementation
candidatedSuperClass = AccessType.getAccessType(_valueClass).getDummyImplementationClass(); candidatedSuperClass = AccessType.getAccessType(_valueClass).getDummyImplementationClass();
} }
objectNode.set(ISManageable.CLASS_PROPERTY, objectNode.set(Element.CLASS_PROPERTY,
new TextNode(candidatedSuperClass.getSimpleName())); new TextNode(candidatedSuperClass.getSimpleName()));
JsonParser jsonParser = jsonFactory.createParser(objectNode JsonParser jsonParser = jsonFactory.createParser(objectNode
.toString()); .toString());

View File

@ -10,7 +10,7 @@ import java.util.List;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.utils.discovery.ISMDiscovery; import org.gcube.informationsystem.utils.discovery.ISMDiscovery;
import org.gcube.informationsystem.utils.discovery.RegistrationProvider; import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
@ -58,10 +58,10 @@ public abstract class ISMapper {
for(AccessType accessType : accessTypes) { for(AccessType accessType : accessTypes) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clz = accessType.getTypeClass(); Class clz = accessType.getTypeClass();
Class<ISManageable> dummyClz = accessType.getDummyImplementationClass(); Class<Element> dummyClz = accessType.getDummyImplementationClass();
if(dummyClz != null) { if(dummyClz != null) {
SimpleModule isModule = new SimpleModule(accessType.getName()); SimpleModule isModule = new SimpleModule(accessType.getName());
isModule.addDeserializer(clz, new ERDeserializer<>(clz, mapper)); isModule.addDeserializer(clz, new ElementDeserializer<>(clz, mapper));
mapper.registerModule(isModule); mapper.registerModule(isModule);
ISMapper.registerSubtypes(dummyClz); ISMapper.registerSubtypes(dummyClz);
} }
@ -97,7 +97,7 @@ public abstract class ISMapper {
} }
public static <ISM extends ISManageable> void registerSubtypes(Class<ISM>... classes) { public static <ISM extends Element> void registerSubtypes(Class<ISM>... classes) {
mapper.registerSubtypes(classes); mapper.registerSubtypes(classes);
} }
@ -111,7 +111,7 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws JsonGenerationException * @throws JsonGenerationException
*/ */
public static <T extends OutputStream, ISM extends ISManageable> T marshal(ISM object, T stream) public static <T extends OutputStream, ISM extends Element> T marshal(ISM object, T stream)
throws JsonGenerationException, JsonMappingException, IOException { throws JsonGenerationException, JsonMappingException, IOException {
mapper.writeValue(stream, object); mapper.writeValue(stream, object);
return stream; return stream;
@ -125,7 +125,7 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws JsonGenerationException * @throws JsonGenerationException
*/ */
public static <T extends Writer, ISM extends ISManageable> T marshal(ISM object, T writer) public static <T extends Writer, ISM extends Element> T marshal(ISM object, T writer)
throws JsonGenerationException, JsonMappingException, IOException { throws JsonGenerationException, JsonMappingException, IOException {
mapper.writeValue(writer, object); mapper.writeValue(writer, object);
return writer; return writer;
@ -137,7 +137,7 @@ public abstract class ISMapper {
* @return the String serialization of a given resource * @return the String serialization of a given resource
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
public static <ISM extends ISManageable> String marshal(ISM object) throws JsonProcessingException { public static <ISM extends Element> String marshal(ISM object) throws JsonProcessingException {
return mapper.writeValueAsString(object); return mapper.writeValueAsString(object);
} }
@ -147,8 +147,8 @@ public abstract class ISMapper {
* @return the String serialization of a given list * @return the String serialization of a given list
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
public static <ISM extends ISManageable> String marshal(List<ISM> list) throws JsonProcessingException { public static <ISM extends Element> String marshal(List<ISM> list) throws JsonProcessingException {
JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, ISManageable.class); JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, Element.class);
return mapper.writerFor(type).writeValueAsString(list); return mapper.writerFor(type).writeValueAsString(list);
} }
@ -158,7 +158,7 @@ public abstract class ISMapper {
* @return the String serialization of a given array * @return the String serialization of a given array
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
public static <ISM extends ISManageable> String marshal(ISM[] array) throws JsonProcessingException { public static <ISM extends Element> String marshal(ISM[] array) throws JsonProcessingException {
return mapper.writeValueAsString(array); return mapper.writeValueAsString(array);
} }
@ -172,7 +172,7 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws IOException * @throws IOException
*/ */
public static <ISM extends ISManageable> ISM unmarshal(Class<ISM> clz, Reader reader) public static <ISM extends Element> ISM unmarshal(Class<ISM> clz, Reader reader)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
return mapper.readValue(reader, clz); return mapper.readValue(reader, clz);
} }
@ -187,7 +187,7 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws JsonParseException * @throws JsonParseException
*/ */
public static <ISM extends ISManageable> ISM unmarshal(Class<ISM> clz, InputStream stream) public static <ISM extends Element> ISM unmarshal(Class<ISM> clz, InputStream stream)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
return mapper.readValue(stream, clz); return mapper.readValue(stream, clz);
} }
@ -201,7 +201,7 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws IOException * @throws IOException
*/ */
public static <ISM extends ISManageable> ISM unmarshal(Class<ISM> clz, String string) public static <ISM extends Element> ISM unmarshal(Class<ISM> clz, String string)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
return mapper.readValue(string, clz); return mapper.readValue(string, clz);
} }
@ -215,20 +215,20 @@ public abstract class ISMapper {
* @throws JsonMappingException * @throws JsonMappingException
* @throws IOException * @throws IOException
*/ */
public static <ISM extends ISManageable> ISM unmarshalWithReader(Class<ISM> clz, String string) public static <ISM extends Element> ISM unmarshalWithReader(Class<ISM> clz, String string)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
return mapper.readerFor(clz).readValue(string); return mapper.readerFor(clz).readValue(string);
} }
public static <ISM extends ISManageable> List<ISM> unmarshalList(Class<ISM> clz, String string) public static <ISM extends Element> List<ISM> unmarshalList(Class<ISM> clz, String string)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, clz); JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, clz);
return mapper.readValue(string, type); return mapper.readValue(string, type);
} }
public static <ISM extends ISManageable> List<ISM> unmarshalList(String string) public static <ISM extends Element> List<ISM> unmarshalList(String string)
throws JsonParseException, JsonMappingException, IOException { 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); return mapper.readValue(string, type);
} }

View File

@ -3,9 +3,9 @@
*/ */
package org.gcube.informationsystem.utils; package org.gcube.informationsystem.utils;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.utils.discovery.SchemaAction; import org.gcube.informationsystem.utils.discovery.SchemaAction;
/** /**
@ -19,21 +19,21 @@ class ISMappingAction implements SchemaAction {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <P extends BaseProperty> void managePropertyClass(Class<P> e) public <P extends PropertyElement> void managePropertyClass(Class<P> e)
throws Exception { throws Exception {
ISMapper.registerSubtypes(e); ISMapper.registerSubtypes(e);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <E extends BaseEntity> void manageEntityClass(Class<E> e) public <E extends EntityElement> void manageEntityClass(Class<E> e)
throws Exception { throws Exception {
ISMapper.registerSubtypes(e); ISMapper.registerSubtypes(e);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <R extends BaseRelation<? extends BaseEntity, ? extends BaseEntity>> void manageRelationClass( public <R extends RelationElement<? extends EntityElement, ? extends EntityElement>> void manageRelationClass(
Class<R> r) throws Exception { Class<R> r) throws Exception {
ISMapper.registerSubtypes(r); ISMapper.registerSubtypes(r);
} }

View File

@ -13,10 +13,10 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
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.annotations.ISProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class ISMDiscovery<ISM extends ISManageable> { public class ISMDiscovery<ISM extends Element> {
private static Logger logger = LoggerFactory.getLogger(ISMDiscovery.class); private static Logger logger = LoggerFactory.getLogger(ISMDiscovery.class);
@ -81,7 +81,7 @@ public class ISMDiscovery<ISM extends ISManageable> {
analizeISM(parent); analizeISM(parent);
} }
if(root == BaseProperty.class) { if(root == PropertyElement.class) {
for(Method m : clz.getDeclaredMethods()) { for(Method m : clz.getDeclaredMethods()) {
m.setAccessible(true); m.setAccessible(true);
@ -92,7 +92,7 @@ public class ISMDiscovery<ISM extends ISManageable> {
Type[] typeArguments = ((ParameterizedType) m.getGenericReturnType()).getActualTypeArguments(); Type[] typeArguments = ((ParameterizedType) m.getGenericReturnType()).getActualTypeArguments();
for(Type t : typeArguments) { for(Type t : typeArguments) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends BaseProperty> tClass = (Class<? extends BaseProperty>) t; Class<? extends PropertyElement> tClass = (Class<? extends PropertyElement>) t;
if(root.isAssignableFrom(tClass)) { if(root.isAssignableFrom(tClass)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<ISM> type = (Class<ISM>) tClass; Class<ISM> type = (Class<ISM>) tClass;
@ -134,23 +134,23 @@ public class ISMDiscovery<ISM extends ISManageable> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void manageISM(SchemaAction schemaAction, Package... packages) throws Exception { public static void manageISM(SchemaAction schemaAction, Package... packages) throws Exception {
ISMDiscovery<BaseProperty> propertyDiscovery = new ISMDiscovery<>(BaseProperty.class); ISMDiscovery<PropertyElement> propertyDiscovery = new ISMDiscovery<>(PropertyElement.class);
if(Objects.nonNull(packages)) { if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> propertyDiscovery.addPackage(p)); Arrays.stream(packages).forEach(p -> propertyDiscovery.addPackage(p));
} }
propertyDiscovery.discover(); propertyDiscovery.discover();
for(Class<? extends BaseProperty> property : propertyDiscovery.getDiscovered()) { for(Class<? extends PropertyElement> property : propertyDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", property); logger.trace("Going to manage : {}", property);
schemaAction.managePropertyClass(property); schemaAction.managePropertyClass(property);
} }
ISMDiscovery<BaseEntity> entityDiscovery = new ISMDiscovery<>(BaseEntity.class); ISMDiscovery<EntityElement> entityDiscovery = new ISMDiscovery<>(EntityElement.class);
if(Objects.nonNull(packages)) { if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> entityDiscovery.addPackage(p)); Arrays.stream(packages).forEach(p -> entityDiscovery.addPackage(p));
} }
entityDiscovery.discover(); entityDiscovery.discover();
for(Class<? extends BaseEntity> entity : entityDiscovery.getDiscovered()) { for(Class<? extends EntityElement> entity : entityDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", entity); logger.trace("Going to manage : {}", entity);
schemaAction.manageEntityClass(entity); schemaAction.manageEntityClass(entity);
/* /*
@ -161,13 +161,13 @@ public class ISMDiscovery<ISM extends ISManageable> {
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ISMDiscovery<BaseRelation> relationDiscovery = new ISMDiscovery<BaseRelation>(BaseRelation.class); ISMDiscovery<RelationElement> relationDiscovery = new ISMDiscovery<RelationElement>(RelationElement.class);
if(Objects.nonNull(packages)) if(Objects.nonNull(packages))
Arrays.stream(packages).forEach(p -> relationDiscovery.addPackage(p)); Arrays.stream(packages).forEach(p -> relationDiscovery.addPackage(p));
relationDiscovery.discover(); relationDiscovery.discover();
for(@SuppressWarnings("rawtypes") for(@SuppressWarnings("rawtypes")
Class<? extends BaseRelation> relation : relationDiscovery.getDiscovered()) { Class<? extends RelationElement> relation : relationDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", relation); logger.trace("Going to manage : {}", relation);
schemaAction.manageRelationClass(relation); schemaAction.manageRelationClass(relation);
/* /*

View File

@ -3,9 +3,9 @@
*/ */
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.utils.discovery;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -13,10 +13,10 @@ import org.gcube.informationsystem.base.reference.relations.BaseRelation;
*/ */
public interface SchemaAction { public interface SchemaAction {
public <P extends BaseProperty> void managePropertyClass(Class<P> e) throws Exception; public <P extends PropertyElement> void managePropertyClass(Class<P> e) throws Exception;
public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception; public <E extends EntityElement> void manageEntityClass(Class<E> e) throws Exception;
public <R extends BaseRelation<? extends BaseEntity, ? extends BaseEntity>> void manageRelationClass(Class<R> r) throws Exception; public <R extends RelationElement<? extends EntityElement, ? extends EntityElement>> void manageRelationClass(Class<R> r) throws Exception;
} }

View File

@ -3,8 +3,8 @@
*/ */
package org.gcube.informationsystem.types; package org.gcube.informationsystem.types;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
@ -23,14 +23,14 @@ public class EntitySchemaDefinition {
@Test @Test
public void test() throws Exception { public void test() throws Exception {
Class<? extends BaseProperty> clz = Header.class; Class<? extends PropertyElement> clz = Header.class;
String json = TypeBinder.serializeType(clz); String json = TypeBinder.serializeType(clz);
logger.trace(json); logger.trace(json);
} }
@Test @Test
public void testRelationSerialization() throws Exception { public void testRelationSerialization() throws Exception {
Class<? extends ISManageable> clz = IsRelatedTo.class; Class<? extends Element> clz = IsRelatedTo.class;
String json = TypeBinder.serializeType(clz); String json = TypeBinder.serializeType(clz);
logger.trace(json); logger.trace(json);
} }

View File

@ -1,7 +1,7 @@
package org.gcube.informationsystem.types; package org.gcube.informationsystem.types;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; 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.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -44,97 +44,97 @@ public class SerializationTest {
@Test @Test
public void makeTypeDefinition() throws Exception{ public void makeTypeDefinition() throws Exception{
EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class); EntityType resourceTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(ResourceType.class);
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf)); logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
} }
@Test @Test
public void testPropertyTypeDefinition() throws Exception{ public void testPropertyTypeDefinition() throws Exception{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<BaseProperty> basePropertyTypeDefinition = (PropertyTypeDefinition<BaseProperty>) TypeBinder.createTypeDefinition(BaseProperty.class); PropertyType<PropertyElement> basePropertyTypeDefinition = (PropertyType<PropertyElement>) TypeBinder.createTypeDefinition(PropertyElement.class);
logger.info(ISMapper.marshal(basePropertyTypeDefinition)); logger.info(ISMapper.marshal(basePropertyTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<Property> propertyTypeDefinition = (PropertyTypeDefinition<Property>) TypeBinder.createTypeDefinition(Property.class); PropertyType<Property> propertyTypeDefinition = (PropertyType<Property>) TypeBinder.createTypeDefinition(Property.class);
logger.info(ISMapper.marshal(propertyTypeDefinition)); logger.info(ISMapper.marshal(propertyTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<Header> headerTypeDefinition = (PropertyTypeDefinition<Header>) TypeBinder.createTypeDefinition(Header.class); PropertyType<Header> headerTypeDefinition = (PropertyType<Header>) TypeBinder.createTypeDefinition(Header.class);
logger.info(ISMapper.marshal(headerTypeDefinition)); logger.info(ISMapper.marshal(headerTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<PropagationConstraint> propagationConstraintDefinition = (PropertyTypeDefinition<PropagationConstraint>) TypeBinder.createTypeDefinition(PropagationConstraint.class); PropertyType<PropagationConstraint> propagationConstraintDefinition = (PropertyType<PropagationConstraint>) TypeBinder.createTypeDefinition(PropagationConstraint.class);
logger.info(ISMapper.marshal(propagationConstraintDefinition)); logger.info(ISMapper.marshal(propagationConstraintDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<Encrypted> encryptedTypeDefinition = (PropertyTypeDefinition<Encrypted>) TypeBinder.createTypeDefinition(Encrypted.class); PropertyType<Encrypted> encryptedTypeDefinition = (PropertyType<Encrypted>) TypeBinder.createTypeDefinition(Encrypted.class);
logger.info(ISMapper.marshal(encryptedTypeDefinition)); logger.info(ISMapper.marshal(encryptedTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<PropertyDefinition> propertyDefinition = (PropertyTypeDefinition<PropertyDefinition>) TypeBinder.createTypeDefinition(PropertyDefinition.class); PropertyType<PropertyDefinition> propertyDefinition = (PropertyType<PropertyDefinition>) TypeBinder.createTypeDefinition(PropertyDefinition.class);
logger.info(ISMapper.marshal(propertyDefinition)); logger.info(ISMapper.marshal(propertyDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PropertyTypeDefinition<ResourceEntryDefinition> resourceEntryDefinition = (PropertyTypeDefinition<ResourceEntryDefinition>) TypeBinder.createTypeDefinition(ResourceEntryDefinition.class); PropertyType<LinkedEntity> resourceEntryDefinition = (PropertyType<LinkedEntity>) TypeBinder.createTypeDefinition(LinkedEntity.class);
logger.info(ISMapper.marshal(resourceEntryDefinition)); logger.info(ISMapper.marshal(resourceEntryDefinition));
} }
@Test @Test
public void testEntityTypeDefinition() throws Exception{ public void testEntityTypeDefinition() throws Exception{
EntityTypeDefinition baseEntityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(BaseEntity.class); EntityType baseEntityTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(EntityElement.class);
logger.info(ISMapper.marshal(baseEntityTypeDefinition)); logger.info(ISMapper.marshal(baseEntityTypeDefinition));
EntityTypeDefinition entityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Entity.class); EntityType entityTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(Entity.class);
logger.info(ISMapper.marshal(entityTypeDefinition)); logger.info(ISMapper.marshal(entityTypeDefinition));
ResourceTypeDefinition resourceTypeDefinition = (ResourceTypeDefinition) TypeBinder.createTypeDefinition(Resource.class); ResourceType resourceTypeDefinition = (ResourceType) TypeBinder.createTypeDefinition(Resource.class);
logger.info(ISMapper.marshal(resourceTypeDefinition)); logger.info(ISMapper.marshal(resourceTypeDefinition));
FacetTypeDefinition facetTypeDefinition = (FacetTypeDefinition) TypeBinder.createTypeDefinition(Facet.class); FacetType facetTypeDefinition = (FacetType) TypeBinder.createTypeDefinition(Facet.class);
logger.info(ISMapper.marshal(facetTypeDefinition)); logger.info(ISMapper.marshal(facetTypeDefinition));
EntityTypeDefinition contextTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Context.class); EntityType contextTypeDefinition = (EntityType) TypeBinder.createTypeDefinition(Context.class);
logger.info(ISMapper.marshal(contextTypeDefinition)); logger.info(ISMapper.marshal(contextTypeDefinition));
EntityTypeDefinition entityTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(EntityTypeDefinition.class); EntityType entityTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(EntityType.class);
logger.info(ISMapper.marshal(entityTypeDefinitionSelf)); logger.info(ISMapper.marshal(entityTypeDefinitionSelf));
EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class); EntityType resourceTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(ResourceType.class);
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf)); logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
EntityTypeDefinition facetTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(FacetTypeDefinition.class); EntityType facetTypeDefinitionSelf = (EntityType) TypeBinder.createTypeDefinition(FacetType.class);
logger.info(ISMapper.marshal(facetTypeDefinitionSelf)); logger.info(ISMapper.marshal(facetTypeDefinitionSelf));
} }
@Test @Test
public void testRelationTypeDefinition() throws Exception{ public void testRelationTypeDefinition() throws Exception{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> relationTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(Relation.class); RelationType<EntityType,EntityType> relationTypeDefinition = (RelationType<EntityType,EntityType>) TypeBinder.createTypeDefinition(Relation.class);
logger.info(ISMapper.marshal(relationTypeDefinition)); logger.info(ISMapper.marshal(relationTypeDefinition));
IsRelatedToTypeDefinition isRelatedToTypeDefinition = (IsRelatedToTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class); IsRelatedToType isRelatedToTypeDefinition = (IsRelatedToType) TypeBinder.createTypeDefinition(IsRelatedTo.class);
logger.info(ISMapper.marshal(isRelatedToTypeDefinition)); logger.info(ISMapper.marshal(isRelatedToTypeDefinition));
ConsistsOfTypeDefinition consistsOfTypeDefinition = (ConsistsOfTypeDefinition) TypeBinder.createTypeDefinition(ConsistsOf.class); ConsistsOfType consistsOfTypeDefinition = (ConsistsOfType) TypeBinder.createTypeDefinition(ConsistsOf.class);
logger.info(ISMapper.marshal(consistsOfTypeDefinition)); logger.info(ISMapper.marshal(consistsOfTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isParentOfTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsParentOf.class); RelationType<EntityType,EntityType> isParentOfTypeDefinition = (RelationType<EntityType,EntityType>) TypeBinder.createTypeDefinition(IsParentOf.class);
logger.info(ISMapper.marshal(isParentOfTypeDefinition)); logger.info(ISMapper.marshal(isParentOfTypeDefinition));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> rtdSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(RelationTypeDefinition.class); RelationType<EntityType,EntityType> rtdSelf = (RelationType<EntityType,EntityType>) TypeBinder.createTypeDefinition(RelationType.class);
logger.info(ISMapper.marshal(rtdSelf)); logger.info(ISMapper.marshal(rtdSelf));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isRelatedToTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsRelatedToTypeDefinition.class); RelationType<EntityType,EntityType> isRelatedToTypeDefinitionSelf = (RelationType<EntityType,EntityType>) TypeBinder.createTypeDefinition(IsRelatedToType.class);
logger.info(ISMapper.marshal(isRelatedToTypeDefinitionSelf)); logger.info(ISMapper.marshal(isRelatedToTypeDefinitionSelf));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> consistsOfTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(ConsistsOfTypeDefinition.class); RelationType<EntityType,EntityType> consistsOfTypeDefinitionSelf = (RelationType<EntityType,EntityType>) TypeBinder.createTypeDefinition(ConsistsOfType.class);
logger.info(ISMapper.marshal(consistsOfTypeDefinitionSelf)); logger.info(ISMapper.marshal(consistsOfTypeDefinitionSelf));
} }

View File

@ -1,14 +1,14 @@
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.utils.discovery;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.junit.Test; import org.junit.Test;
public class ISMDiscoveryTest { public class ISMDiscoveryTest {
@Test @Test
public void testISMDIscovery() { public void testISMDIscovery() {
ISMDiscovery<BaseProperty> propertyDiscovery = new ISMDiscovery<>(BaseProperty.class); ISMDiscovery<PropertyElement> propertyDiscovery = new ISMDiscovery<>(PropertyElement.class);
propertyDiscovery.analizeISM(PropertyTypeDefinition.class); propertyDiscovery.analizeISM(PropertyType.class);
} }
} }