Reorganizing Information System Model
This commit is contained in:
parent
c0b5908960
commit
7f5512571c
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.informationsystem.querytemplates.impl.properties;
|
||||||
|
|
||||||
|
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
|
||||||
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
|
||||||
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
@JsonTypeName(value=TemplateProperty.NAME)
|
||||||
|
public class TemplateVariableImpl extends PropertyElementImpl implements TemplateVariable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated Serial Version UID
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2628113641100130640L;
|
||||||
|
|
||||||
|
protected String name;
|
||||||
|
protected String description;
|
||||||
|
protected String defaultValue;
|
||||||
|
|
||||||
|
public TemplateVariableImpl() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDefaultValue(String defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,7 +9,6 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
|
||||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||||
import org.gcube.informationsystem.querytemplates.impl.entities.QueryTemplateImpl;
|
import org.gcube.informationsystem.querytemplates.impl.entities.QueryTemplateImpl;
|
||||||
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
|
||||||
|
@ -28,7 +27,7 @@ import org.gcube.informationsystem.utils.Version;
|
||||||
@JsonDeserialize(as=QueryTemplateImpl.class)
|
@JsonDeserialize(as=QueryTemplateImpl.class)
|
||||||
@TypeMetadata(name = QueryTemplate.NAME, description = "The type used to store Query Templates", version = Version.MINIMAL_VERSION_STRING)
|
@TypeMetadata(name = QueryTemplate.NAME, description = "The type used to store Query Templates", version = Version.MINIMAL_VERSION_STRING)
|
||||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||||
public interface QueryTemplate extends IdentifiableElement, EntityElement {
|
public interface QueryTemplate extends EntityElement {
|
||||||
|
|
||||||
public static final String NAME = "QueryTemplate"; //QueryTemplate.class.getSimpleName();
|
public static final String NAME = "QueryTemplate"; //QueryTemplate.class.getSimpleName();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.gcube.informationsystem.types.impl.entities;
|
package org.gcube.informationsystem.types.impl.entities;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
@ -10,6 +12,7 @@ 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.querytemplates.reference.entities.QueryTemplate;
|
||||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||||
|
@ -27,6 +30,16 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2614315845213942880L;
|
private static final long serialVersionUID = 2614315845213942880L;
|
||||||
|
|
||||||
|
private static Set<String> entityTypeAccesTypes;
|
||||||
|
|
||||||
|
static {
|
||||||
|
entityTypeAccesTypes = new HashSet<>();
|
||||||
|
entityTypeAccesTypes.add(EntityType.NAME);
|
||||||
|
entityTypeAccesTypes.add(ResourceType.NAME);
|
||||||
|
entityTypeAccesTypes.add(FacetType.NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private static final String VERTEX_CLASS_NAME = "V";
|
// private static final String VERTEX_CLASS_NAME = "V";
|
||||||
|
|
||||||
public static EntityType getEntityTypeDefinitionInstance(Class<? extends EntityElement> clz) {
|
public static EntityType getEntityTypeDefinitionInstance(Class<? extends EntityElement> clz) {
|
||||||
|
@ -58,6 +71,10 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
||||||
@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, EntityElement.NAME);
|
this.superClasses = 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);
|
||||||
} else if(EntityElement.class.isAssignableFrom(clz)){
|
} else if(EntityElement.class.isAssignableFrom(clz)){
|
||||||
this.superClasses = retrieveSuperClasses(clz, EntityElement.class, null);
|
this.superClasses = retrieveSuperClasses(clz, EntityElement.class, null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,9 +131,11 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
||||||
return AccessType.ENTITY_ELEMENT;
|
return AccessType.ENTITY_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name.compareTo(EntityType.NAME)==0 ||
|
if(name.compareTo(QueryTemplate.NAME)==0) {
|
||||||
name.compareTo(ResourceType.NAME)==0 ||
|
return AccessType.QUERY_TEMPLATE;
|
||||||
name.compareTo(FacetType.NAME)==0) {
|
}
|
||||||
|
|
||||||
|
if(entityTypeAccesTypes.contains(name)) {
|
||||||
return AccessType.ENTITY_TYPE;
|
return AccessType.ENTITY_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package org.gcube.informationsystem.types.impl.properties;
|
package org.gcube.informationsystem.types.impl.properties;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import org.gcube.informationsystem.base.reference.AccessType;
|
import org.gcube.informationsystem.base.reference.AccessType;
|
||||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||||
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
|
||||||
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable;
|
||||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||||
import org.gcube.informationsystem.types.reference.properties.Changelog;
|
|
||||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||||
|
@ -26,6 +28,17 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
||||||
|
|
||||||
protected Set<PropertyDefinition> properties;
|
protected Set<PropertyDefinition> properties;
|
||||||
|
|
||||||
|
private static Set<String> propertyElementAccesTypes;
|
||||||
|
|
||||||
|
static {
|
||||||
|
propertyElementAccesTypes = new HashSet<>();
|
||||||
|
propertyElementAccesTypes.add(PropertyElement.NAME);
|
||||||
|
propertyElementAccesTypes.add(LinkedEntity.NAME);
|
||||||
|
propertyElementAccesTypes.add(TemplateVariable.NAME);
|
||||||
|
propertyElementAccesTypes.add(TemplateProperty.NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected PropertyTypeImpl() {
|
protected PropertyTypeImpl() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -55,9 +68,7 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
||||||
return AccessType.PROPERTY_DEFINITION;
|
return AccessType.PROPERTY_DEFINITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name.compareTo(PropertyElement.NAME)==0 ||
|
if(propertyElementAccesTypes.contains(name)) {
|
||||||
name.compareTo(LinkedEntity.NAME)==0 ||
|
|
||||||
name.compareTo(Changelog.NAME)==0) {
|
|
||||||
return AccessType.PROPERTY_ELEMENT;
|
return AccessType.PROPERTY_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
package org.gcube.informationsystem.types.reference.properties;
|
|
||||||
|
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
||||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
||||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
|
||||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
|
||||||
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
|
|
||||||
import org.gcube.informationsystem.types.reference.Change;
|
|
||||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
|
||||||
import org.gcube.informationsystem.utils.Version;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
|
||||||
*/
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
@JsonDeserialize(as = PropertyDefinitionImpl.class)
|
|
||||||
@TypeMetadata(name = Changelog.NAME, description = "This class provides version information for any Type", version = Version.MINIMAL_VERSION_STRING)
|
|
||||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
|
||||||
public interface Changelog extends PropertyElement {
|
|
||||||
|
|
||||||
public static final String NAME = "Changelog";
|
|
||||||
|
|
||||||
public static final String VERSION_PROPERTY = "version";
|
|
||||||
public static final String CHANGE_PROPERTY = "changelog";
|
|
||||||
|
|
||||||
@ISProperty(name = VERSION_PROPERTY, readonly = true, mandatory = true, nullable = false, regexpr = "")
|
|
||||||
public Version getVersion();
|
|
||||||
|
|
||||||
@ISProperty(name = CHANGE_PROPERTY, readonly = true, mandatory = true, nullable = false)
|
|
||||||
public String getChange();
|
|
||||||
|
|
||||||
}
|
|
|
@ -153,11 +153,6 @@ public class ElementSpecilizationDiscovery<E extends Element> {
|
||||||
for(Class<? extends EntityElement> 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);
|
||||||
/*
|
|
||||||
if(entity.getName().compareTo(BaseEntity.class.getName())==0 ) {
|
|
||||||
schemaAction.manageEntityClass(EntityTypeDefinition.class);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
@ -170,11 +165,6 @@ public class ElementSpecilizationDiscovery<E extends Element> {
|
||||||
Class<? extends RelationElement> 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);
|
||||||
/*
|
|
||||||
if(relation.getName().compareTo(BaseRelation.class.getName())==0 ) {
|
|
||||||
schemaAction.manageRelationClass(RelationTypeDefinition.class);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,11 @@ 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.querytemplates.reference.properties.TemplateProperty;
|
||||||
|
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable;
|
||||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||||
import org.gcube.informationsystem.types.reference.properties.Changelog;
|
|
||||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||||
|
@ -100,10 +101,14 @@ public class SerializationTest {
|
||||||
logger.info(ElementMapper.marshal(encrypted));
|
logger.info(ElementMapper.marshal(encrypted));
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
PropertyType<Changelog> changelog = (PropertyType<Changelog>) TypeMapper.createTypeDefinition(Changelog.class);
|
PropertyType<TemplateProperty> templateProperty = (PropertyType<TemplateProperty>) TypeMapper.createTypeDefinition(TemplateProperty.class);
|
||||||
Assert.assertTrue(changelog.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
Assert.assertTrue(templateProperty.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||||
logger.info(ElementMapper.marshal(changelog));
|
logger.info(ElementMapper.marshal(templateProperty));
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
PropertyType<TemplateVariable> templateVariable = (PropertyType<TemplateVariable>) TypeMapper.createTypeDefinition(TemplateVariable.class);
|
||||||
|
Assert.assertTrue(templateVariable.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||||
|
logger.info(ElementMapper.marshal(templateVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue