Fixed type definition
This commit is contained in:
parent
1421a53b52
commit
c289601f6f
|
@ -11,6 +11,7 @@ import org.gcube.informationsystem.base.reference.ISManageable;
|
|||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
@ -45,6 +46,8 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
|
|||
protected boolean abstractType;
|
||||
protected Set<String> superClasses;
|
||||
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
protected <ISM extends ISManageable> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){
|
||||
Set<String> interfaceList = new HashSet<>();
|
||||
|
||||
|
@ -108,7 +111,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
|
|||
typeDefinition = EntityTypeDefinitionImpl.getEntityTypeDefinitionInstance((Class<? extends BaseEntity>) clz);
|
||||
return typeDefinition;
|
||||
} else if(BaseRelation.class.isAssignableFrom(clz)){
|
||||
typeDefinition = new RelationTypeDefinitionImpl((Class<? extends BaseRelation<?,?>>) clz);
|
||||
typeDefinition = RelationTypeDefinitionImpl.getRelationTypeDefinitionInstance((Class<? extends BaseRelation<?,?>>) clz);
|
||||
return typeDefinition;
|
||||
} else if(BaseProperty.class.isAssignableFrom(clz)){
|
||||
typeDefinition = new PropertyTypeDefinitionImpl(clz);
|
||||
|
@ -137,6 +140,10 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
|
|||
this.abstractType = true;
|
||||
}
|
||||
|
||||
if(!Resource.class.isAssignableFrom(clz)) {
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,4 +166,9 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
|
|||
return superClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@ import org.gcube.informationsystem.utils.ISMapper;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=EntityTypeDefinition.NAME)
|
||||
public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements EntityTypeDefinition {
|
||||
|
||||
|
@ -24,21 +27,16 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti
|
|||
// private static final String VERTEX_CLASS_NAME = "V";
|
||||
|
||||
public static EntityTypeDefinition getEntityTypeDefinitionInstance(Class<? extends BaseEntity> clz) {
|
||||
EntityTypeDefinition entityTypeDefinition;
|
||||
if(Resource.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Resource> c = (Class<? extends Resource>) clz;
|
||||
entityTypeDefinition = new ResourceTypeDefinitionImpl(c);
|
||||
return entityTypeDefinition;
|
||||
return new ResourceTypeDefinitionImpl((Class<? extends Resource>) c);
|
||||
} else if(Facet.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Facet> c = (Class<? extends Facet>) clz;
|
||||
entityTypeDefinition = new FacetTypeDefinitionImpl(c);
|
||||
return entityTypeDefinition;
|
||||
} else {
|
||||
entityTypeDefinition = new EntityTypeDefinitionImpl(clz);
|
||||
}
|
||||
return entityTypeDefinition;
|
||||
return new FacetTypeDefinitionImpl(c);
|
||||
}
|
||||
return new EntityTypeDefinitionImpl(clz);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +60,6 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti
|
|||
} else {
|
||||
throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package org.gcube.informationsystem.types.impl.entities;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=FacetTypeDefinition.NAME)
|
||||
public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements FacetTypeDefinition {
|
||||
|
||||
|
@ -16,8 +16,6 @@ public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements
|
|||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 6268161046955738969L;
|
||||
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
protected FacetTypeDefinitionImpl() {
|
||||
super();
|
||||
|
@ -26,14 +24,8 @@ public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements
|
|||
public FacetTypeDefinitionImpl(Class<? extends Facet> clz) {
|
||||
super(clz);
|
||||
|
||||
Class<? extends Facet> c = (Class<? extends Facet>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, Facet.class, Entity.NAME);
|
||||
this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.entities;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.annotations.ResourceSchema;
|
||||
|
@ -14,6 +15,9 @@ import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefin
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=ResourceTypeDefinition.NAME)
|
||||
public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl implements ResourceTypeDefinition {
|
||||
|
||||
|
@ -31,6 +35,9 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme
|
|||
|
||||
public ResourceTypeDefinitionImpl(Class<? extends Resource> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
|
||||
|
||||
setResourceSchemaEntries(clz);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package org.gcube.informationsystem.types.impl.properties;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
@ -18,8 +15,6 @@ public final class PropertyTypeDefinitionImpl<P extends BaseProperty> extends Ty
|
|||
*/
|
||||
private static final long serialVersionUID = 7532701373450638829L;
|
||||
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
protected PropertyTypeDefinitionImpl() {
|
||||
super();
|
||||
}
|
||||
|
@ -28,12 +23,6 @@ public final class PropertyTypeDefinitionImpl<P extends BaseProperty> extends Ty
|
|||
super(clz);
|
||||
this.superClasses = retrieveSuperClasses(clz, BaseProperty.class,
|
||||
clz == BaseProperty.class ? null : BaseProperty.NAME);
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package org.gcube.informationsystem.types.impl.relations;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=ConsistsOfTypeDefinition.NAME)
|
||||
public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, FacetTypeDefinition> implements ConsistsOfTypeDefinition {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2891976493165330476L;
|
||||
|
||||
protected ConsistsOfTypeDefinitionImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ConsistsOfTypeDefinitionImpl(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
||||
discoverSourceAndTarget(clz);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void discoverSourceAndTarget(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
|
||||
Type[] typeParameters = clz.getTypeParameters();
|
||||
|
||||
Class<? extends Resource> sourceClass;
|
||||
Class<? extends Facet> targetClass;
|
||||
if(typeParameters.length==0) {
|
||||
typeParameters = getParametersFromSuperClasses(clz);
|
||||
sourceClass = (Class<? extends Resource>) typeParameters[0];
|
||||
targetClass = (Class<? extends Facet>) typeParameters[1];
|
||||
}else {
|
||||
sourceClass = (Class<? extends Resource>) getGenericClass(typeParameters[0]);
|
||||
targetClass = (Class<? extends Facet>) getGenericClass(typeParameters[1]);
|
||||
}
|
||||
|
||||
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass);
|
||||
this.target = new FacetTypeDefinitionImpl((Class<? extends Facet>) targetClass);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.gcube.informationsystem.types.impl.relations;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeName(value=IsRelatedToTypeDefinition.NAME)
|
||||
public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, ResourceTypeDefinition> implements IsRelatedToTypeDefinition {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 8448665395204514722L;
|
||||
|
||||
protected IsRelatedToTypeDefinitionImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IsRelatedToTypeDefinitionImpl(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
||||
discoverSourceAndTarget(clz);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void discoverSourceAndTarget(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
|
||||
Type[] typeParameters = clz.getTypeParameters();
|
||||
|
||||
Class<? extends Resource> sourceClass;
|
||||
Class<? extends Resource> targetClass;
|
||||
if(typeParameters.length==0) {
|
||||
typeParameters = getParametersFromSuperClasses(clz);
|
||||
sourceClass = (Class<? extends Resource>) typeParameters[0];
|
||||
targetClass = (Class<? extends Resource>) typeParameters[1];
|
||||
}else {
|
||||
sourceClass = (Class<? extends Resource>) getGenericClass(typeParameters[0]);
|
||||
targetClass = (Class<? extends Resource>) getGenericClass(typeParameters[1]);
|
||||
}
|
||||
|
||||
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass);
|
||||
this.target = new ResourceTypeDefinitionImpl((Class<? extends Resource>) targetClass);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package org.gcube.informationsystem.types.impl.relations;
|
|||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
|
@ -11,129 +10,122 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
|
|||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
@JsonTypeName(value=RelationTypeDefinition.NAME)
|
||||
public final class RelationTypeDefinitionImpl extends TypeDefinitionImpl implements RelationTypeDefinition {
|
||||
|
||||
@JsonTypeName(value = RelationTypeDefinition.NAME)
|
||||
public class RelationTypeDefinitionImpl<S extends EntityTypeDefinition, T extends EntityTypeDefinition>
|
||||
extends TypeDefinitionImpl implements RelationTypeDefinition<S,T> {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2221831081869571296L;
|
||||
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
protected RelationTypeDefinitionImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
public RelationTypeDefinitionImpl(Class<? extends BaseRelation<?, ?>> clz) {
|
||||
super(clz);
|
||||
|
||||
if(IsRelatedTo.class.isAssignableFrom(clz)){
|
||||
public static RelationTypeDefinition<?,?> getRelationTypeDefinitionInstance(
|
||||
Class<? extends BaseRelation<?,?>> clz) {
|
||||
if(IsRelatedTo.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, IsRelatedTo.class, Relation.NAME);
|
||||
Class<? extends IsRelatedTo<? extends Resource,? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource,? extends Resource>>) clz;
|
||||
return new IsRelatedToTypeDefinitionImpl(c);
|
||||
} else if(ConsistsOf.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource, ? extends Facet>>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, ConsistsOf.class, Relation.NAME);
|
||||
} else if(RelationTypeDefinition.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends ConsistsOf<? extends Resource,? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource,? extends Facet>>) clz;
|
||||
return new ConsistsOfTypeDefinitionImpl(c);
|
||||
}
|
||||
return new RelationTypeDefinitionImpl<EntityTypeDefinition,EntityTypeDefinition>(clz);
|
||||
}
|
||||
|
||||
public RelationTypeDefinitionImpl(Class<? extends BaseRelation<?,?>> clz) {
|
||||
super(clz);
|
||||
|
||||
if(RelationTypeDefinition.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Class<RelationTypeDefinition> c = (Class<RelationTypeDefinition>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME);
|
||||
} else if(IsParentOf.class.isAssignableFrom(clz)){
|
||||
} else if(IsParentOf.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IsParentOf> c = (Class<? extends IsParentOf>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, IsParentOf.class, BaseRelation.NAME);
|
||||
} else if(BaseRelation.class.isAssignableFrom(clz)){
|
||||
} else if(BaseRelation.class.isAssignableFrom(clz)) {
|
||||
this.superClasses = retrieveSuperClasses(clz, BaseRelation.class, null);
|
||||
} else {
|
||||
throw new RuntimeException("Type Hierachy Error");
|
||||
}
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
||||
discoverSourceAndTarget(clz);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Type[] getParametersFromSuperClasses(Class<? extends BaseRelation<?, ?>> clz) {
|
||||
for(Type t : clz.getGenericInterfaces()){
|
||||
protected Type[] getParametersFromSuperClasses(Class<? extends BaseRelation<?,?>> clz) {
|
||||
for(Type t : clz.getGenericInterfaces()) {
|
||||
if(t instanceof ParameterizedType) {
|
||||
if(BaseRelation.class.isAssignableFrom((Class<?>) ((ParameterizedType) t).getRawType())) {
|
||||
return ((ParameterizedType) t).getActualTypeArguments();
|
||||
}
|
||||
}else if(BaseRelation.class.isAssignableFrom((Class<?>) t)){
|
||||
return getParametersFromSuperClasses((Class<? extends BaseRelation<?, ?>>) t);
|
||||
} else if(BaseRelation.class.isAssignableFrom((Class<?>) t)) {
|
||||
return getParametersFromSuperClasses((Class<? extends BaseRelation<?,?>>) t);
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Unable to find Generic Parameters From SuperClasses to set source and target");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void discoverSourceAndTarget(Class<? extends BaseRelation<?, ?>> clz) {
|
||||
private void discoverSourceAndTarget(Class<? extends BaseRelation<?,?>> clz) {
|
||||
Type[] typeParameters = clz.getTypeParameters();
|
||||
|
||||
Class<? extends BaseEntity> sourceClass;
|
||||
Class<? extends BaseEntity> targetClass;
|
||||
if(typeParameters.length==0) {
|
||||
if(typeParameters.length == 0) {
|
||||
typeParameters = getParametersFromSuperClasses(clz);
|
||||
sourceClass = (Class<? extends BaseEntity>) typeParameters[0];
|
||||
targetClass = (Class<? extends BaseEntity>) typeParameters[1];
|
||||
}else {
|
||||
} else {
|
||||
sourceClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[0]);
|
||||
targetClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[1]);
|
||||
}
|
||||
|
||||
this.source = new EntityTypeDefinitionImpl(sourceClass);
|
||||
this.target = new EntityTypeDefinitionImpl(targetClass);
|
||||
this.source = (S) new EntityTypeDefinitionImpl(sourceClass);
|
||||
this.target = (T) new EntityTypeDefinitionImpl(targetClass);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Java does not support class multiple inheritance.
|
||||
* TypeDefinitionImpl is the superclass so that this class does not inherits the methods and field of BaseRelationImpl
|
||||
* We need to copy them.
|
||||
*/
|
||||
|
||||
protected EntityTypeDefinition source;
|
||||
protected EntityTypeDefinition target;
|
||||
protected S source;
|
||||
protected T target;
|
||||
|
||||
@Override
|
||||
public EntityTypeDefinition getSource() {
|
||||
public S getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setSource(EntityTypeDefinition source) {
|
||||
public void setSource(S source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public EntityTypeDefinition getTarget() {
|
||||
public T getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setTarget(EntityTypeDefinition target) {
|
||||
public void setTarget(T target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package org.gcube.informationsystem.types.reference;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
* This is just an useful interface to capture all type definition having properties
|
||||
* such as FacetTypeDefinition, PropertyTypeDefinition, RelationTypeDefinition
|
||||
*/
|
||||
public interface PropertyCapableTypeDefinition {
|
||||
|
||||
public static final String PROPERTIES_PROPERTY = "properties";
|
||||
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.util.Set;
|
|||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
|
@ -19,6 +20,7 @@ public interface TypeDefinition extends ER {
|
|||
public static final String DESCRIPTION_PROPERTY = "description";
|
||||
public static final String ABSTRACT_PROPERTY = "abstract";
|
||||
public static final String TYPE_SUPERCLASSES_PROPERTY = "superClasses";
|
||||
public static final String PROPERTIES_PROPERTY = "properties";
|
||||
|
||||
@ISProperty(name = NAME_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public String getName();
|
||||
|
@ -32,4 +34,7 @@ public interface TypeDefinition extends ER {
|
|||
@ISProperty(name = TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
|
||||
@ISProperty(name = PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,13 @@ import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
|||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = EntityTypeDefinitionImpl.class) // Do not uncomment to manage subclasses
|
||||
@JsonDeserialize(as = EntityTypeDefinitionImpl.class)
|
||||
public interface EntityTypeDefinition extends TypeDefinition, BaseEntity {
|
||||
|
||||
public static final String NAME = "EntityTypeDefinition"; //EntityTypeDefinition.class.getSimpleName();
|
||||
|
@ -34,6 +35,9 @@ public interface EntityTypeDefinition extends TypeDefinition, BaseEntity {
|
|||
@ISProperty(name = TypeDefinition.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
package org.gcube.informationsystem.types.reference.entities;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = FacetTypeDefinitionImpl.class)
|
||||
public interface FacetTypeDefinition extends EntityTypeDefinition, BaseEntity, PropertyCapableTypeDefinition {
|
||||
public interface FacetTypeDefinition extends EntityTypeDefinition, BaseEntity {
|
||||
|
||||
public static final String NAME = "FacetTypeDefinition"; //FacetTypeDefinition.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
|||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
@ -15,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = PropertyTypeDefinitionImpl.class)
|
||||
public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefinition, BaseProperty, PropertyCapableTypeDefinition {
|
||||
public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefinition, BaseProperty {
|
||||
|
||||
public static final String NAME = "PropertyTypeDefinition"; // PropertyTypeDefinition.class.getSimpleName();
|
||||
|
||||
|
@ -43,7 +42,7 @@ public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefi
|
|||
public Set<String> getSuperClasses();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
@ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonDeserialize(as = ConsistsOfTypeDefinitionImpl.class)
|
||||
public interface ConsistsOfTypeDefinition extends RelationTypeDefinition<ResourceTypeDefinition, FacetTypeDefinition> {
|
||||
|
||||
public static final String NAME = "ConsistsOfTypeDefinition"; // ConsistsOfTypeDefinition.class.getSimpleName();
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
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();
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ import java.util.Set;
|
|||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
@ -15,9 +14,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = RelationTypeDefinitionImpl.class)
|
||||
public interface RelationTypeDefinition extends TypeDefinition, BaseRelation<EntityTypeDefinition,EntityTypeDefinition>, PropertyCapableTypeDefinition {
|
||||
public interface RelationTypeDefinition<S extends EntityTypeDefinition, T extends EntityTypeDefinition>
|
||||
extends TypeDefinition, BaseRelation<S,T> {
|
||||
|
||||
public static final String NAME = "RelationTypeDefinition"; // PropertyTypeDefiniton.class.getSimpleName();
|
||||
public static final String NAME = "RelationTypeDefinition"; // RelationTypeDefinition.class.getSimpleName();
|
||||
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
|
@ -32,21 +32,21 @@ public interface RelationTypeDefinition extends TypeDefinition, BaseRelation<Ent
|
|||
@Override
|
||||
@ISProperty(name = TypeDefinition.ABSTRACT_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public boolean isAbstract();
|
||||
|
||||
|
||||
@Override
|
||||
@ISProperty(name = TypeDefinition.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
|
||||
|
||||
@Override
|
||||
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
@ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
@Override
|
||||
public EntityTypeDefinition getSource();
|
||||
public S getSource();
|
||||
|
||||
@Override
|
||||
public EntityTypeDefinition getTarget();
|
||||
|
||||
public T getTarget();
|
||||
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
/*@JsonGetter(value=SOURCE_PROPERTY)
|
||||
public String getSourceType();
|
||||
|
|
|
@ -18,8 +18,6 @@ import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
|||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -155,9 +153,11 @@ public class ISMDiscovery<ISM extends ISManageable> {
|
|||
for(Class<? extends BaseEntity> entity : entityDiscovery.getDiscovered()) {
|
||||
logger.trace("Going to manage : {}", entity);
|
||||
schemaAction.manageEntityClass(entity);
|
||||
/*
|
||||
if(entity.getName().compareTo(BaseEntity.class.getName())==0 ) {
|
||||
schemaAction.manageEntityClass(EntityTypeDefinition.class);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -170,9 +170,11 @@ public class ISMDiscovery<ISM extends ISManageable> {
|
|||
Class<? extends BaseRelation> relation : relationDiscovery.getDiscovered()) {
|
||||
logger.trace("Going to manage : {}", relation);
|
||||
schemaAction.manageRelationClass(relation);
|
||||
/*
|
||||
if(relation.getName().compareTo(BaseRelation.class.getName())==0 ) {
|
||||
schemaAction.manageRelationClass(RelationTypeDefinition.class);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
package org.gcube.informationsystem.types;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.junit.Test;
|
||||
|
@ -25,23 +36,67 @@ public class SerializationTest {
|
|||
TypeBinder.serializeType(EntityTest.class);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getISParentOfSchema() throws Exception{
|
||||
RelationTypeDefinition relationTypeDefinition = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class);
|
||||
logger.info(ISMapper.marshal(relationTypeDefinition));
|
||||
|
||||
RelationTypeDefinition rtd = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsParentOf.class);
|
||||
logger.info(ISMapper.marshal(rtd));
|
||||
|
||||
RelationTypeDefinition rtdSelf = (RelationTypeDefinition) TypeBinder.createTypeDefinition(RelationTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(rtdSelf));
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
PropertyTypeDefinition ptd = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(PropertyTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(ptd));
|
||||
public void makeTypeDefinition() throws Exception{
|
||||
EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityTypeDefinition() throws Exception{
|
||||
EntityTypeDefinition baseEntityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(BaseEntity.class);
|
||||
logger.info(ISMapper.marshal(baseEntityTypeDefinition));
|
||||
|
||||
EntityTypeDefinition entityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Entity.class);
|
||||
logger.info(ISMapper.marshal(entityTypeDefinition));
|
||||
|
||||
ResourceTypeDefinition resourceTypeDefinition = (ResourceTypeDefinition) TypeBinder.createTypeDefinition(Resource.class);
|
||||
logger.info(ISMapper.marshal(resourceTypeDefinition));
|
||||
|
||||
FacetTypeDefinition facetTypeDefinition = (FacetTypeDefinition) TypeBinder.createTypeDefinition(Facet.class);
|
||||
logger.info(ISMapper.marshal(facetTypeDefinition));
|
||||
|
||||
EntityTypeDefinition contextTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Context.class);
|
||||
logger.info(ISMapper.marshal(contextTypeDefinition));
|
||||
|
||||
EntityTypeDefinition entityTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(EntityTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(entityTypeDefinitionSelf));
|
||||
|
||||
EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
|
||||
|
||||
EntityTypeDefinition facetTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(FacetTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(facetTypeDefinitionSelf));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelationTypeDefinition() throws Exception{
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> relationTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(Relation.class);
|
||||
logger.info(ISMapper.marshal(relationTypeDefinition));
|
||||
|
||||
IsRelatedToTypeDefinition isRelatedToTypeDefinition = (IsRelatedToTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class);
|
||||
logger.info(ISMapper.marshal(isRelatedToTypeDefinition));
|
||||
|
||||
ConsistsOfTypeDefinition consistsOfTypeDefinition = (ConsistsOfTypeDefinition) TypeBinder.createTypeDefinition(ConsistsOf.class);
|
||||
logger.info(ISMapper.marshal(consistsOfTypeDefinition));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isParentOfTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsParentOf.class);
|
||||
logger.info(ISMapper.marshal(isParentOfTypeDefinition));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> rtdSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(RelationTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(rtdSelf));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isRelatedToTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsRelatedToTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(isRelatedToTypeDefinitionSelf));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> consistsOfTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(ConsistsOfTypeDefinition.class);
|
||||
logger.info(ISMapper.marshal(consistsOfTypeDefinitionSelf));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetEnumcostants(){
|
||||
|
@ -60,18 +115,14 @@ public class SerializationTest {
|
|||
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan);
|
||||
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String pg = mapper.writeValueAsString(propagationConstraint);
|
||||
|
||||
|
||||
PropagationConstraint pgUnm = mapper.readValue(pg, PropagationConstraint.class);
|
||||
|
||||
logger.debug("{}", pgUnm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testTypeSerialization() throws Exception {
|
||||
String serialized = TypeBinder.serializeType(Header.class);
|
||||
|
|
Loading…
Reference in New Issue