Finalising reorganization

This commit is contained in:
Luca Frosini 2019-10-24 15:03:14 +02:00
parent 108046c4a1
commit 6df4a0f5c4
13 changed files with 89 additions and 43 deletions

View File

@ -23,12 +23,11 @@ import org.gcube.informationsystem.types.reference.properties.PropertyDefinition
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY) // @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
@JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeName(value=TypeDefinition.NAME)
public abstract class TypeDefinitionImpl<ISM extends ISManageable> extends ERImpl implements TypeDefinition<ISM> { public abstract class TypeDefinitionImpl<ISM extends ISManageable> extends ERImpl implements TypeDefinition<ISM> {
/** /**

View File

@ -5,12 +5,15 @@ 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.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.EntityDefinition; import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
public class EntityTypeDefinitionImpl<E extends BaseEntity> extends TypeDefinitionImpl<E> implements EntityDefinition<E> { import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value=EntityTypeDefinition.NAME)
public class EntityTypeDefinitionImpl<E extends BaseEntity> extends TypeDefinitionImpl<E> implements EntityTypeDefinition<E> {
/** /**
* * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2614315845213942880L; private static final long serialVersionUID = 2614315845213942880L;

View File

@ -14,15 +14,15 @@ 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;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY) // @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
@JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeName(value=PropertyDefinition.NAME)
public final class PropertyDefinitionImpl implements PropertyDefinition { public final class PropertyDefinitionImpl implements PropertyDefinition {
/** /**

View File

@ -4,10 +4,13 @@ import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefiniton; import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefiniton;
import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value=PropertyTypeDefiniton.NAME)
public class PropertyTypeDefinitionImpl<P extends BaseProperty> extends TypeDefinitionImpl<P> implements PropertyTypeDefiniton<P> { public class PropertyTypeDefinitionImpl<P extends BaseProperty> extends TypeDefinitionImpl<P> implements PropertyTypeDefiniton<P> {
/** /**
* * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 7532701373450638829L; private static final long serialVersionUID = 7532701373450638829L;

View File

@ -7,16 +7,18 @@ 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.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.EntityDefinition; import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationDefinition; import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value=RelationTypeDefinition.NAME)
public class RelationTypeDefinitionImpl<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>> public class RelationTypeDefinitionImpl<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>>
extends TypeDefinitionImpl<Rel> implements RelationDefinition<Out,In,Rel> { extends TypeDefinitionImpl<Rel> implements RelationTypeDefinition<Out,In,Rel> {
/** /**
* * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2221831081869571296L; private static final long serialVersionUID = 2221831081869571296L;
@ -62,25 +64,25 @@ public class RelationTypeDefinitionImpl<Out extends BaseEntity, In extends BaseE
} }
@Override @Override
public EntityDefinition<Out> getSource() { public EntityTypeDefinition<Out> getSource() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setSource(EntityDefinition<Out> source) { public void setSource(EntityTypeDefinition<Out> source) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override
public EntityDefinition<In> getTarget() { public EntityTypeDefinition<In> getTarget() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setTarget(EntityDefinition<In> target) { public void setTarget(EntityTypeDefinition<In> target) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }

View File

@ -4,10 +4,18 @@ import java.util.Set;
import org.gcube.informationsystem.base.reference.ER; import org.gcube.informationsystem.base.reference.ER;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.ISManageable;
import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Abstract
@JsonIgnoreProperties(ignoreUnknown=true)
//@JsonDeserialize(as=TypeDefinitionImpl.class) Do not uncomment to manage subclasses
public interface TypeDefinition<ISM extends ISManageable> extends ER { public interface TypeDefinition<ISM extends ISManageable> extends ER {
public static final String NAME = "TypeDefinition"; //Entity.class.getSimpleName();
public String getName(); public String getName();
public String getDescription(); public String getDescription();

View File

@ -1,8 +0,0 @@
package org.gcube.informationsystem.types.reference.entities;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.types.reference.TypeDefinition;
public interface EntityDefinition<E extends BaseEntity> extends TypeDefinition<E>, BaseEntity {
}

View File

@ -0,0 +1,16 @@
package org.gcube.informationsystem.types.reference.entities;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = EntityTypeDefinitionImpl.class)
public interface EntityTypeDefinition<E extends BaseEntity> extends TypeDefinition<E>, BaseEntity {
public static final String NAME = "EntityDefinition"; //EntityDefinition.class.getSimpleName();
}

View File

@ -3,12 +3,14 @@ package org.gcube.informationsystem.types.reference.properties;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
* https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header * https://wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Header
*/ */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyDefinitionImpl.class) @JsonDeserialize(as = PropertyDefinitionImpl.class)
public interface PropertyDefinition extends BaseProperty { public interface PropertyDefinition extends BaseProperty {

View File

@ -1,9 +1,14 @@
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.BaseProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyTypeDefinitionImpl.class)
public interface PropertyTypeDefiniton<P extends BaseProperty> extends TypeDefinition<P>, BaseProperty { public interface PropertyTypeDefiniton<P extends BaseProperty> extends TypeDefinition<P>, BaseProperty {
public static final String NAME = "PropertyTypeDefiniton"; // PropertyTypeDefiniton.class.getSimpleName(); public static final String NAME = "PropertyTypeDefiniton"; // PropertyTypeDefiniton.class.getSimpleName();

View File

@ -1,15 +0,0 @@
package org.gcube.informationsystem.types.reference.relations;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityDefinition;
public interface RelationDefinition<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>>
extends TypeDefinition<Rel>, BaseRelation<EntityDefinition<Out>,EntityDefinition<In>> {
public String getSourceType();
public String getTargetType();
}

View File

@ -0,0 +1,23 @@
package org.gcube.informationsystem.types.reference.relations;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = RelationTypeDefinitionImpl.class)
public interface RelationTypeDefinition<Out extends BaseEntity, In extends BaseEntity, Rel extends BaseRelation<Out,In>>
extends TypeDefinition<Rel>, BaseRelation<EntityTypeDefinition<Out>,EntityTypeDefinition<In>> {
public static final String NAME = "RelationTypeDefinition"; // PropertyTypeDefiniton.class.getSimpleName();
public String getSourceType();
public String getTargetType();
}

View File

@ -1,5 +1,6 @@
package org.gcube.informationsystem.types; package org.gcube.informationsystem.types;
import org.gcube.informationsystem.base.reference.properties.Header;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
@ -47,4 +48,11 @@ public class SerializationTest {
logger.debug("{}", pgUnm); logger.debug("{}", pgUnm);
} }
@Test
public void testTypeSerialization() throws Exception {
String serialized = TypeBinder.serializeType(Header.class);
logger.info(serialized);
}
} }