Reorganizing classes
This commit is contained in:
parent
141cf6c19a
commit
787c811a04
|
@ -3,15 +3,15 @@ package org.gcube.informationsystem.model.impl.properties;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariable;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariableDefinition;
|
||||
import org.gcube.informationsystem.model.reference.properties.Attribute;
|
||||
import org.gcube.informationsystem.model.reference.properties.AttributeDefinition;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
// @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
|
||||
@JsonTypeName(value=PropertyVariableDefinition.NAME)
|
||||
public class PropertyVariableDefinitionImpl extends PropertyVariableImpl implements PropertyVariableDefinition {
|
||||
@JsonTypeName(value=AttributeDefinition.NAME)
|
||||
public class AttributeDefinitionImpl extends AttributeImpl implements AttributeDefinition {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -22,7 +22,7 @@ public class PropertyVariableDefinitionImpl extends PropertyVariableImpl impleme
|
|||
protected boolean readonly = false;
|
||||
protected boolean notnull = false;
|
||||
|
||||
public PropertyVariableDefinitionImpl() {
|
||||
public AttributeDefinitionImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,11 @@ public class PropertyVariableDefinitionImpl extends PropertyVariableImpl impleme
|
|||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PropertyVariableDefinitionImpl other = (PropertyVariableDefinitionImpl) obj;
|
||||
AttributeDefinitionImpl other = (AttributeDefinitionImpl) obj;
|
||||
return mandatory == other.mandatory && notnull == other.notnull && readonly == other.readonly;
|
||||
}
|
||||
|
||||
public int compareTo(PropertyVariableDefinition other) {
|
||||
public int compareTo(AttributeDefinition other) {
|
||||
if (this == other) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ public class PropertyVariableDefinitionImpl extends PropertyVariableImpl impleme
|
|||
return -1;
|
||||
}
|
||||
|
||||
PropertyVariableDefinitionImpl o = (PropertyVariableDefinitionImpl) other;
|
||||
AttributeDefinitionImpl o = (AttributeDefinitionImpl) other;
|
||||
|
||||
int ret = super.compareTo((PropertyVariable) other);
|
||||
int ret = super.compareTo((Attribute) other);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
|
@ -12,9 +12,8 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariable;
|
||||
import org.gcube.informationsystem.model.reference.properties.Attribute;
|
||||
import org.gcube.informationsystem.types.PropertyTypeName;
|
||||
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -24,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
// @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
|
||||
@JsonTypeName(value=PropertyVariable.NAME)
|
||||
public class PropertyVariableImpl extends PropertyElementImpl implements PropertyVariable {
|
||||
@JsonTypeName(value=Attribute.NAME)
|
||||
public class AttributeImpl extends PropertyImpl implements Attribute {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -44,7 +43,7 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
|
||||
protected Object defaultValue=null;
|
||||
|
||||
protected PropertyVariableImpl() {
|
||||
protected AttributeImpl() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -159,13 +158,13 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
@JsonProperty(value =PropertyVariable.PROPERTY_TYPE_PROPERTY, index=30)
|
||||
@JsonProperty(value =Attribute.PROPERTY_TYPE_PROPERTY, index=30)
|
||||
@Override
|
||||
public String getPropertyType() {
|
||||
return propertyTypeName.toString();
|
||||
}
|
||||
|
||||
@JsonSetter(value = PropertyVariable.PROPERTY_TYPE_PROPERTY)
|
||||
@JsonSetter(value = Attribute.PROPERTY_TYPE_PROPERTY)
|
||||
@Override
|
||||
public void setPropertyType(String type) {
|
||||
this.propertyTypeName = new PropertyTypeName(type);
|
||||
|
@ -217,7 +216,7 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
|
||||
@Override
|
||||
public void setRegexp(String regexp) {
|
||||
PropertyVariableImpl.checkRegex(regexp, null);
|
||||
AttributeImpl.checkRegex(regexp, null);
|
||||
this.regexp = regexp;
|
||||
}
|
||||
|
||||
|
@ -250,7 +249,7 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
PropertyVariableImpl other = (PropertyVariableImpl) obj;
|
||||
AttributeImpl other = (AttributeImpl) obj;
|
||||
return Objects.equals(name, other.name) &&
|
||||
Objects.equals(description, other.description) &&
|
||||
Objects.equals(max, other.max) &&
|
||||
|
@ -267,7 +266,7 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PropertyVariable other) {
|
||||
public int compareTo(Attribute other) {
|
||||
if (this == other) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -278,7 +277,7 @@ public class PropertyVariableImpl extends PropertyElementImpl implements Propert
|
|||
return -1;
|
||||
}
|
||||
|
||||
PropertyVariableImpl o = (PropertyVariableImpl) other;
|
||||
AttributeImpl o = (AttributeImpl) other;
|
||||
|
||||
int ret = 0;
|
||||
ret = name.compareTo(o.name);
|
|
@ -2,8 +2,7 @@ package org.gcube.informationsystem.model.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.model.impl.properties.PropertyVariableImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.AttributeImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -13,12 +12,12 @@ import org.gcube.informationsystem.utils.Version;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = PropertyVariableImpl.class)
|
||||
@TypeMetadata(name = PropertyVariable.NAME, description = "This type provides the basic information for the definition of attributes and and variables", version = Version.MINIMAL_VERSION_STRING)
|
||||
@JsonDeserialize(as = AttributeImpl.class)
|
||||
@TypeMetadata(name = Attribute.NAME, description = "This type provides the basic information for the definition of attributes and and variables", version = Version.MINIMAL_VERSION_STRING)
|
||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||
public interface PropertyVariable extends PropertyElement, Comparable<PropertyVariable> {
|
||||
public interface Attribute extends Property, Comparable<Attribute> {
|
||||
|
||||
public static final String NAME = "PropertyVariable"; // PropertyVariable.class.getSimpleName();
|
||||
public static final String NAME = "Attribute"; // Attribute.class.getSimpleName();
|
||||
|
||||
public static final String NAME_PROPERTY = "name";
|
||||
public static final String DESCRIPTION_PROPERTY = "description";
|
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.model.reference.properties;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropertyVariableDefinitionImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.AttributeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -12,10 +12,10 @@ import org.gcube.informationsystem.utils.Version;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonDeserialize(as = PropertyVariableDefinitionImpl.class)
|
||||
@TypeMetadata(name = PropertyVariableDefinition.NAME, description = "This type provides all the information for the definition of attributes and and variables", version = Version.MINIMAL_VERSION_STRING)
|
||||
@JsonDeserialize(as = AttributeDefinitionImpl.class)
|
||||
@TypeMetadata(name = AttributeDefinition.NAME, description = "This type provides all the information for the definition of attributes and and variables", version = Version.MINIMAL_VERSION_STRING)
|
||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||
public interface PropertyVariableDefinition extends PropertyVariable {
|
||||
public interface AttributeDefinition extends Attribute {
|
||||
|
||||
public static final String NAME = "PropertyVariableDefinition"; // PropertyVariableDefinition.class.getSimpleName();
|
||||
|
|
@ -5,7 +5,7 @@ package org.gcube.informationsystem.queries.templates.impl.properties;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropertyVariableImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.AttributeImpl;
|
||||
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
||||
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
|||
*/
|
||||
@JsonTypeName(value=TemplateVariable.NAME)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class TemplateVariableImpl extends PropertyVariableImpl implements TemplateVariable {
|
||||
public class TemplateVariableImpl extends AttributeImpl implements TemplateVariable {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.informationsystem.queries.templates.reference.properties;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariable;
|
||||
import org.gcube.informationsystem.model.reference.properties.Attribute;
|
||||
import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.Changelog;
|
||||
|
@ -17,7 +17,7 @@ import org.gcube.informationsystem.utils.Version;
|
|||
@Change(version = TemplateVariable.VERSION, description = "The type now is a subclass of @link{PropertyVariable}"),
|
||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||
})
|
||||
public interface TemplateVariable extends PropertyVariable {
|
||||
public interface TemplateVariable extends Attribute {
|
||||
|
||||
public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName();
|
||||
public static final String VERSION = "2.0.0";
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.lang.reflect.Method;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropertyVariableDefinitionImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropertyVariableImpl;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariableDefinition;
|
||||
import org.gcube.informationsystem.model.impl.properties.AttributeDefinitionImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.AttributeImpl;
|
||||
import org.gcube.informationsystem.model.reference.properties.AttributeDefinition;
|
||||
import org.gcube.informationsystem.types.PropertyTypeName;
|
||||
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
|
@ -17,7 +17,7 @@ import org.gcube.informationsystem.types.reference.properties.PropertyDefinition
|
|||
*/
|
||||
// @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
|
||||
@JsonTypeName(value=PropertyDefinition.NAME)
|
||||
public final class PropertyDefinitionImpl extends PropertyVariableDefinitionImpl implements PropertyDefinition {
|
||||
public final class PropertyDefinitionImpl extends AttributeDefinitionImpl implements PropertyDefinition {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -64,7 +64,7 @@ public final class PropertyDefinitionImpl extends PropertyVariableDefinitionImpl
|
|||
defaultValueAsString = evaluateNullForDefaultValue(defaultValueAsString);
|
||||
|
||||
// The default value is evaluated to test if compliant with the declared type
|
||||
this.defaultValue = PropertyVariableImpl.evaluateDefaultValueStringAccordingBaseType(propertyTypeName.getBaseType(), defaultValueAsString);
|
||||
this.defaultValue = AttributeImpl.evaluateDefaultValueStringAccordingBaseType(propertyTypeName.getBaseType(), defaultValueAsString);
|
||||
|
||||
Class<?> clz = method.getReturnType();
|
||||
logger.trace("Return Type for method {} is {}", method, clz);
|
||||
|
@ -154,9 +154,7 @@ public final class PropertyDefinitionImpl extends PropertyVariableDefinitionImpl
|
|||
return -1;
|
||||
}
|
||||
|
||||
PropertyDefinitionImpl o = (PropertyDefinitionImpl) other;
|
||||
|
||||
int ret = super.compareTo((PropertyVariableDefinition) other);
|
||||
int ret = super.compareTo((AttributeDefinition) other);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariable;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariableDefinition;
|
||||
import org.gcube.informationsystem.model.reference.properties.Attribute;
|
||||
import org.gcube.informationsystem.model.reference.properties.AttributeDefinition;
|
||||
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||
|
@ -36,8 +36,8 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
|||
static {
|
||||
propertyElementAccesTypes = new HashSet<>();
|
||||
propertyElementAccesTypes.add(PropertyElement.NAME);
|
||||
propertyElementAccesTypes.add(PropertyVariable.NAME);
|
||||
propertyElementAccesTypes.add(PropertyVariableDefinition.NAME);
|
||||
propertyElementAccesTypes.add(Attribute.NAME);
|
||||
propertyElementAccesTypes.add(AttributeDefinition.NAME);
|
||||
propertyElementAccesTypes.add(LinkedEntity.NAME);
|
||||
propertyElementAccesTypes.add(TemplateVariable.NAME);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ 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.model.reference.properties.PropertyVariableDefinition;
|
||||
import org.gcube.informationsystem.model.reference.properties.AttributeDefinition;
|
||||
import org.gcube.informationsystem.types.annotations.Final;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
|
@ -21,7 +21,7 @@ import org.gcube.informationsystem.utils.Version;
|
|||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||
})
|
||||
@Final
|
||||
public interface PropertyDefinition extends PropertyVariableDefinition {
|
||||
public interface PropertyDefinition extends AttributeDefinition {
|
||||
|
||||
public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName();
|
||||
public static final String VERSION = "2.0.0";
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
|||
import org.gcube.informationsystem.model.reference.properties.Metadata;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropertyVariable;
|
||||
import org.gcube.informationsystem.model.reference.properties.Attribute;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
@ -60,7 +60,7 @@ public class SerializationTest {
|
|||
|
||||
@Test
|
||||
public void serializePropertyBasicInfo() throws Exception{
|
||||
TypeMapper.serializeType(PropertyVariable.class);
|
||||
TypeMapper.serializeType(Attribute.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -91,7 +91,7 @@ public class SerializationTest {
|
|||
logger.info(ElementMapper.marshal(propertyElement));
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
PropertyType<PropertyVariable> propertyVariable = (PropertyType<PropertyVariable>) TypeMapper.createTypeDefinition(PropertyVariable.class);
|
||||
PropertyType<Attribute> propertyVariable = (PropertyType<Attribute>) TypeMapper.createTypeDefinition(Attribute.class);
|
||||
Assert.assertTrue(propertyVariable.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||
logger.info(ElementMapper.marshal(propertyVariable));
|
||||
|
||||
|
|
Loading…
Reference in New Issue