Changed superclasses in typeSuperTypes
This commit is contained in:
parent
3511b7d248
commit
817c875b86
|
@ -75,7 +75,7 @@ public class TypeImpl implements Type {
|
|||
@JsonProperty(value = FINAL_PROPERTY)
|
||||
protected boolean finalClass;
|
||||
|
||||
protected Set<String> superClasses;
|
||||
protected Set<String> typeSuperTypes;
|
||||
|
||||
protected Set<PropertyDefinition> properties;
|
||||
|
||||
|
@ -275,8 +275,8 @@ public class TypeImpl implements Type {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSuperClasses() {
|
||||
return superClasses;
|
||||
public Set<String> getTypeSuperTypes() {
|
||||
return typeSuperTypes;
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_EMPTY)
|
||||
|
|
|
@ -66,17 +66,17 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
|||
if(EntityType.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends EntityType> c = (Class<? extends EntityType>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, EntityType.class, EntityElement.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(c, EntityType.class, EntityElement.NAME);
|
||||
} else if(Context.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Context> c = (Class<? extends Context>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, Context.class, EntityElement.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(c, Context.class, EntityElement.NAME);
|
||||
} else if(QueryTemplate.class.isAssignableFrom(clz)){
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends QueryTemplate> c = (Class<? extends QueryTemplate>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, QueryTemplate.class, EntityElement.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(c, QueryTemplate.class, EntityElement.NAME);
|
||||
} else if(EntityElement.class.isAssignableFrom(clz)){
|
||||
this.superClasses = retrieveSuperClasses(clz, EntityElement.class, null);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, EntityElement.class, null);
|
||||
} else {
|
||||
throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName());
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public final class FacetTypeImpl extends EntityTypeImpl implements FacetType {
|
|||
|
||||
public FacetTypeImpl(Class<? extends Facet> clz) {
|
||||
super(clz);
|
||||
this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, Facet.class, Entity.NAME);
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class ResourceTypeImpl extends EntityTypeImpl implements ResourceTy
|
|||
public ResourceTypeImpl(Class<? extends Resource> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
|
||||
|
||||
setResourceSchemaEntries(clz);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
|||
|
||||
public PropertyTypeImpl(Class<P> clz) {
|
||||
super(clz);
|
||||
this.superClasses = retrieveSuperClasses(clz, PropertyElement.class,
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, PropertyElement.class,
|
||||
clz == PropertyElement.class ? null : PropertyElement.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
|
|
@ -33,7 +33,7 @@ public final class ConsistsOfTypeImpl extends RelationTypeImpl<ResourceType, Fac
|
|||
public ConsistsOfTypeImpl(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class IsRelatedToTypeImpl extends RelationTypeImpl<ResourceType, Re
|
|||
public IsRelatedToTypeImpl(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
|
||||
super(clz);
|
||||
|
||||
this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
|
||||
|
||||
this.properties = retrieveListOfProperties(clz);
|
||||
|
||||
|
|
|
@ -58,13 +58,13 @@ public class RelationTypeImpl<S extends EntityType, T extends EntityType>
|
|||
if(RelationType.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Class<RelationType<?,?>> c = (Class<RelationType<?,?>>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, RelationType.class, RelationElement.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(c, RelationType.class, RelationElement.NAME);
|
||||
} else if(IsParentOf.class.isAssignableFrom(clz)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IsParentOf> c = (Class<? extends IsParentOf>) clz;
|
||||
this.superClasses = retrieveSuperClasses(c, IsParentOf.class, RelationElement.NAME);
|
||||
this.typeSuperTypes = retrieveSuperClasses(c, IsParentOf.class, RelationElement.NAME);
|
||||
} else if(RelationElement.class.isAssignableFrom(clz)) {
|
||||
this.superClasses = retrieveSuperClasses(clz, RelationElement.class, null);
|
||||
this.typeSuperTypes = retrieveSuperClasses(clz, RelationElement.class, null);
|
||||
} else {
|
||||
throw new RuntimeException("Type Hierachy Error");
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public interface Type extends IdentifiableElement {
|
|||
public static final String CHANGELOG_PROPERTY = "changelog";
|
||||
public static final String ABSTRACT_PROPERTY = "abstract";
|
||||
public static final String FINAL_PROPERTY = "final";
|
||||
public static final String TYPE_SUPERCLASSES_PROPERTY = "superClasses";
|
||||
public static final String TYPE_SUPER_TYPES_PROPERTY = "typeSuperTypes";
|
||||
public static final String PROPERTIES_PROPERTY = "properties";
|
||||
|
||||
@JsonGetter(value = UUID_PROPERTY)
|
||||
|
@ -74,7 +74,8 @@ public interface Type extends IdentifiableElement {
|
|||
@JsonGetter(value = FINAL_PROPERTY)
|
||||
public boolean isFinal();
|
||||
|
||||
public Set<String> getSuperClasses();
|
||||
@JsonGetter(value = TYPE_SUPER_TYPES_PROPERTY)
|
||||
public Set<String> getTypeSuperTypes();
|
||||
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ public interface EntityType extends Type, EntityElement {
|
|||
public boolean isAbstract();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = Type.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
@ISProperty(name = Type.TYPE_SUPER_TYPES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getTypeSuperTypes();
|
||||
|
||||
/* Type is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ public interface PropertyType<P extends PropertyElement> extends PropertyElement
|
|||
public boolean isAbstract();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = Type.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
@ISProperty(name = Type.TYPE_SUPER_TYPES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getTypeSuperTypes();
|
||||
|
||||
@ISProperty(name = Type.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
|
|
@ -41,8 +41,8 @@ public interface RelationType<S extends EntityType, T extends EntityType>
|
|||
public boolean isAbstract();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = Type.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getSuperClasses();
|
||||
@ISProperty(name = Type.TYPE_SUPER_TYPES_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
||||
public Set<String> getTypeSuperTypes();
|
||||
|
||||
@Override
|
||||
@ISProperty(name = Type.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
|
|
|
@ -41,8 +41,8 @@ public class DiscoveryTest {
|
|||
Assert.assertTrue(type.getDescription().compareTo(expected.getDescription())==0);
|
||||
Assert.assertTrue(type.isAbstract() == expected.isAbstract());
|
||||
|
||||
Assert.assertTrue(type.getSuperClasses().containsAll(expected.getSuperClasses()));
|
||||
Assert.assertTrue(expected.getSuperClasses().containsAll(type.getSuperClasses()));
|
||||
Assert.assertTrue(type.getTypeSuperTypes().containsAll(expected.getTypeSuperTypes()));
|
||||
Assert.assertTrue(expected.getTypeSuperTypes().containsAll(type.getTypeSuperTypes()));
|
||||
|
||||
|
||||
Map<Version, String> typeChangelog = type.getChangelog();
|
||||
|
|
|
@ -207,7 +207,7 @@ public class SerializationTest {
|
|||
logger.debug("Version {}", typeVersion.toString());
|
||||
logger.info(ElementMapper.marshal(propertyType));
|
||||
|
||||
String json = "{\"" + Element.TYPE_PROPERTY + "\":\"PropertyType\",\"metadata\":null,\"name\":\"Metadata\",\"description\":\"This class provides metadata per every IdentifiableElement\",\"superClasses\":[\"Property\"],\"properties\":[{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"creationTime\",\"description\":\"Creation time. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateTime\",\"description\":\"Last Update time. At creation time it assumes the same value of creationTime. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"createdBy\",\"description\":\"The user that created the Entity or the Relation. It is initialized at creation time. \",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"uuid\",\"description\":\"This UUID is be used to identify the Entity or the Relation univocally.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":\"^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}){1}$\",\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateBy\",\"description\":\"The user that made the last update to the Entity or the Relation. At creation time, it assumes the same value of creator.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"}],\"accessType\":\"PROPERTY\",\"abstract\":false,\"version\":\"1.0.0\",\"changelog\":{\"1.0.0\":\"First Version\"}}";
|
||||
String json = "{\"" + Element.TYPE_PROPERTY + "\":\"PropertyType\",\"metadata\":null,\"name\":\"Metadata\",\"description\":\"This class provides metadata per every IdentifiableElement\",\"typeSuperTypes\":[\"Property\"],\"properties\":[{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"creationTime\",\"description\":\"Creation time. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateTime\",\"description\":\"Last Update time. At creation time it assumes the same value of creationTime. It represents the difference, measured in milliseconds, between the creation time and midnight, January 1, 1970, UTC.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"Date\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"createdBy\",\"description\":\"The user that created the Entity or the Relation. It is initialized at creation time. \",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"uuid\",\"description\":\"This UUID is be used to identify the Entity or the Relation univocally.\",\"mandatory\":true,\"readonly\":true,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":\"^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}){1}$\",\"propertyType\":\"String\"},{\"" + Element.TYPE_PROPERTY + "\":\"PropertyDefinition\",\"name\":\"lastUpdateBy\",\"description\":\"The user that made the last update to the Entity or the Relation. At creation time, it assumes the same value of creator.\",\"mandatory\":true,\"readonly\":false,\"notnull\":true,\"max\":null,\"min\":null,\"regexp\":null,\"propertyType\":\"String\"}],\"accessType\":\"PROPERTY\",\"abstract\":false,\"version\":\"1.0.0\",\"changelog\":{\"1.0.0\":\"First Version\"}}";
|
||||
logger.info(json);
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Metadata> metadataType = (PropertyType<Metadata>) TypeMapper.deserializeTypeDefinition(json);
|
||||
|
|
Loading…
Reference in New Issue