Reorganizing classes

This commit is contained in:
Luca Frosini 2024-06-04 16:56:08 +02:00
parent 1399f7709b
commit 49e000bfa2
10 changed files with 253 additions and 110 deletions

View File

@ -0,0 +1,58 @@
/**
*
*/
package org.gcube.informationsystem.base.impl.properties;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.reference.properties.PropertyBasicInfo;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=PropertyBasicInfo.NAME)
public class PropertyBasicInfoImpl extends PropertyElementImpl implements PropertyBasicInfo {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -2023568034206025789L;
protected String name;
protected String description;
protected String defaultValue;
public PropertyBasicInfoImpl() {
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;
}
}

View File

@ -8,9 +8,11 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.impl.entities.EntityElementImpl; import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
import org.gcube.informationsystem.base.impl.properties.PropertyBasicInfoImpl;
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl; import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
import org.gcube.informationsystem.base.impl.relations.RelationElementImpl; import org.gcube.informationsystem.base.impl.relations.RelationElementImpl;
import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyBasicInfo;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.contexts.impl.entities.ContextImpl; import org.gcube.informationsystem.contexts.impl.entities.ContextImpl;
@ -57,6 +59,7 @@ import org.slf4j.LoggerFactory;
public enum AccessType { public enum AccessType {
PROPERTY_ELEMENT(PropertyElement.class, PropertyElement.NAME, PropertyElementImpl.class, null), PROPERTY_ELEMENT(PropertyElement.class, PropertyElement.NAME, PropertyElementImpl.class, null),
PROPERTY_BASIC_INFO(PropertyBasicInfo.class, PropertyBasicInfo.NAME, PropertyBasicInfoImpl.class, null),
PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null), PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null),
PROPERTY_TYPE(PropertyType.class, PropertyType.NAME, PropertyTypeImpl.class, null), PROPERTY_TYPE(PropertyType.class, PropertyType.NAME, PropertyTypeImpl.class, null),
TEMPLATE_VARIABLE(TemplateVariable.class, TemplateVariable.NAME, TemplateVariableImpl.class, null), TEMPLATE_VARIABLE(TemplateVariable.class, TemplateVariable.NAME, TemplateVariableImpl.class, null),

View File

@ -0,0 +1,39 @@
package org.gcube.informationsystem.base.reference.properties;
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.gcube.informationsystem.base.impl.properties.PropertyBasicInfoImpl;
import org.gcube.informationsystem.types.annotations.ISProperty;
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)
*/
@JsonDeserialize(as=PropertyBasicInfoImpl.class)
@TypeMetadata(name = PropertyBasicInfo.NAME, description = "This is the class used to define any property or variable", version = Version.MINIMAL_VERSION_STRING)
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface PropertyBasicInfo extends PropertyElement {
public static final String NAME = "PropertyBasicInfo"; // PropertyBasicInfo.class.getSimpleName();
public static final String NAME_PROPERTY = "name";
public static final String DESCRIPTION_PROPERTY = "description";
public static final String DEFAULT_VALUE_PROPERTY = "defaultValue";
@ISProperty(name = NAME_PROPERTY, description = "The name of the Property/Variable.", readonly = true, mandatory = true, nullable = false)
public String getName();
public void setName(String name);
@ISProperty(name = DESCRIPTION_PROPERTY, description = "The description of the Property/Variable.", readonly = false, mandatory = true, nullable = false)
public String getDescription();
public void setDescription(String description);
@ISProperty(name = DEFAULT_VALUE_PROPERTY, description = "The default value of the Property/Variable. The default value is used as is. If the value needs quotation or escaping please include them to the default value", readonly = false, mandatory = true, nullable = false)
public String getDefaultValue();
public void setDefaultValue(String defaultValue);
}

View File

@ -8,6 +8,7 @@ import org.gcube.informationsystem.model.impl.properties.PropagationConstraintIm
import org.gcube.informationsystem.types.annotations.Final; import org.gcube.informationsystem.types.annotations.Final;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.Changelog;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
@ -28,8 +29,10 @@ import org.gcube.informationsystem.utils.Version;
*/ */
@JsonDeserialize(as=PropagationConstraintImpl.class) @JsonDeserialize(as=PropagationConstraintImpl.class)
@TypeMetadata(name = PropagationConstraint.NAME, description = "This type provides propagation constraint for Relation", version = "1.1.0") @TypeMetadata(name = PropagationConstraint.NAME, description = "This type provides propagation constraint for Relation", version = "1.1.0")
@Change(version = "1.1.0", description = "Added 'delete' propagation constraint") @Changelog({
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) @Change(version = "1.1.0", description = "Added 'delete' propagation constraint"),
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
})
@Final @Final
public interface PropagationConstraint extends Property { public interface PropagationConstraint extends Property {

View File

@ -4,56 +4,23 @@
package org.gcube.informationsystem.queries.templates.impl.properties; package org.gcube.informationsystem.queries.templates.impl.properties;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl; import org.gcube.informationsystem.base.impl.properties.PropertyBasicInfoImpl;
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable; import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=TemplateVariable.NAME) @JsonTypeName(value=TemplateVariable.NAME)
public class TemplateVariableImpl extends PropertyElementImpl implements TemplateVariable { public class TemplateVariableImpl extends PropertyBasicInfoImpl implements TemplateVariable {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2628113641100130640L; private static final long serialVersionUID = 2628113641100130640L;
protected String name;
protected String description;
protected String defaultValue;
public TemplateVariableImpl() { public TemplateVariableImpl() {
super(); 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;
}
} }

View File

@ -1,10 +1,10 @@
package org.gcube.informationsystem.queries.templates.reference.properties; package org.gcube.informationsystem.queries.templates.reference.properties;
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyBasicInfo;
import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl; import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl;
import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.Changelog;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
@ -13,28 +13,12 @@ import org.gcube.informationsystem.utils.Version;
*/ */
@JsonDeserialize(as=TemplateVariableImpl.class) @JsonDeserialize(as=TemplateVariableImpl.class)
@TypeMetadata(name = TemplateVariable.NAME, description = "This is the class used to define the a TemplateVariable", version = Version.MINIMAL_VERSION_STRING) @TypeMetadata(name = TemplateVariable.NAME, description = "This is the class used to define the a TemplateVariable", version = Version.MINIMAL_VERSION_STRING)
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) @Changelog ({
public interface TemplateVariable extends PropertyElement { @Change(version = "2.0.0", description = "The type now is a subclass of @link{PropertyBasicInfo}"),
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
})
public interface TemplateVariable extends PropertyBasicInfo {
public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName(); public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName();
public static final String VARIABLE_NAME_PROPERTY = "name";
public static final String VARIABLE_DESCRIPTION_PROPERTY = "description";
public static final String VARIABLE_DEFAULT_VALUE_PROPERTY = "defaultValue";
@ISProperty(name = VARIABLE_NAME_PROPERTY, description = "The name of the Query Template Variable.", readonly = true, mandatory = true, nullable = false)
public String getName();
public void setName(String name);
@ISProperty(name = VARIABLE_DESCRIPTION_PROPERTY, description = "The description of the Query Template Variable.", readonly = false, mandatory = true, nullable = false)
public String getDescription();
public void setDescription(String description);
@ISProperty(name = VARIABLE_DEFAULT_VALUE_PROPERTY, description = "The default value of the Query Template Variable. The default value is used as is to the query. If the value needs quotation or escaping please include them to the default value", readonly = false, mandatory = true, nullable = false)
public String getDefaultValue();
public void setDefaultValue(String defaultValue);
} }

View File

@ -119,6 +119,7 @@ public class PropertyTypeName {
} }
protected static final Map<Class<?>,BaseType> BASE_PROPERTY_TYPES_BY_CLASS; protected static final Map<Class<?>,BaseType> BASE_PROPERTY_TYPES_BY_CLASS;
protected static final Map<Class<?>,String> REGEX_BY_CLASS_MAPPED_AS_STRING;
static { static {
BASE_PROPERTY_TYPES_BY_CLASS = new HashMap<>(); BASE_PROPERTY_TYPES_BY_CLASS = new HashMap<>();
@ -170,6 +171,33 @@ public class PropertyTypeName {
BASE_PROPERTY_TYPES_BY_CLASS.put(UUID.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(UUID.class, BaseType.STRING);
BASE_PROPERTY_TYPES_BY_CLASS.put(Version.class, BaseType.STRING); BASE_PROPERTY_TYPES_BY_CLASS.put(Version.class, BaseType.STRING);
REGEX_BY_CLASS_MAPPED_AS_STRING = new HashMap<>();
REGEX_BY_CLASS_MAPPED_AS_STRING.put(URI.class, PropertyTypeName.URI_REGEX);
REGEX_BY_CLASS_MAPPED_AS_STRING.put(URL.class, PropertyTypeName.URL_REGEX);
REGEX_BY_CLASS_MAPPED_AS_STRING.put(UUID.class,PropertyTypeName.UUID_REGEX);
REGEX_BY_CLASS_MAPPED_AS_STRING.put(Version.class, Version.VERSION_REGEX);
}
public final static String URI_REGEX = null;
public final static String URL_REGEX = null;
public final static String UUID_REGEX = "^([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}$";
public static String getRegexByClass(Class<?> clz) {
if(Enum.class.isAssignableFrom(clz)){
Object[] constants = clz.getEnumConstants();
StringBuilder stringBuilder = new StringBuilder("^(");
for(int i=0; i<constants.length; i++){
stringBuilder.append(constants[i].toString());
if(i<constants.length-1){
stringBuilder.append("|");
}
}
stringBuilder.append(")$");
return stringBuilder.toString();
}
return REGEX_BY_CLASS_MAPPED_AS_STRING.get(clz);
} }
/** /**
@ -183,9 +211,7 @@ public class PropertyTypeName {
if(clazz == null) { if(clazz == null) {
return null; return null;
} }
BaseType type = BASE_PROPERTY_TYPES_BY_CLASS.get(clazz); BaseType type = BASE_PROPERTY_TYPES_BY_CLASS.get(clazz);
if(type == null) { if(type == null) {
for(Class<?> c : BASE_PROPERTY_TYPES_BY_CLASS.keySet()) { for(Class<?> c : BASE_PROPERTY_TYPES_BY_CLASS.keySet()) {
if(c.isAssignableFrom(clazz)) { if(c.isAssignableFrom(clazz)) {
@ -193,7 +219,6 @@ public class PropertyTypeName {
} }
} }
} }
return type; return type;
} }

View File

@ -31,5 +31,6 @@ public @interface ISProperty {
int min() default -1; int min() default -1;
int max() default -1; int max() default -1;
String regexpr() default ""; String regexpr() default "";
String defaultValue() default "";
} }

View File

@ -1,19 +1,24 @@
package org.gcube.informationsystem.types.impl.properties; package org.gcube.informationsystem.types.impl.properties;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URI; import java.sql.Date;
import java.net.URL; import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter; import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.impl.properties.PropertyBasicInfoImpl;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.types.PropertyTypeName; import org.gcube.informationsystem.types.PropertyTypeName;
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.TypeUtility; import org.gcube.informationsystem.utils.TypeUtility;
import org.gcube.informationsystem.utils.Version;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -22,7 +27,7 @@ import org.slf4j.LoggerFactory;
*/ */
// @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY) // @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
@JsonTypeName(value=PropertyDefinition.NAME) @JsonTypeName(value=PropertyDefinition.NAME)
public final class PropertyDefinitionImpl implements PropertyDefinition { public final class PropertyDefinitionImpl extends PropertyBasicInfoImpl implements PropertyDefinition {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
@ -31,18 +36,13 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
private static Logger logger = LoggerFactory.getLogger(PropertyDefinitionImpl.class); private static Logger logger = LoggerFactory.getLogger(PropertyDefinitionImpl.class);
public final static String UUID_REGEX = "^([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}$";
public final static String URI_REGEX = null;
public final static String URL_REGEX = null;
private String name= "";
private String description= "";
private boolean mandatory = false; private boolean mandatory = false;
private boolean readonly = false; private boolean readonly = false;
private boolean notnull = false; private boolean notnull = false;
private Integer max= null; private Integer max= null;
private Integer min= null; private Integer min= null;
private String regexp= null; private String regexp= null;
private String defaultValue=null;
private PropertyTypeName propertyTypeName = null; private PropertyTypeName propertyTypeName = null;
private static String getPropertyNameFromMethodName(Method method){ private static String getPropertyNameFromMethodName(Method method){
@ -66,6 +66,82 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
} }
public static void checkRegex(String regex, String text) {
try {
Pattern pattern = Pattern.compile(regex);
if(text!=null) {
Matcher matcher = pattern.matcher(text);
if(!matcher.find()) {
throw new RuntimeException("The value '" + text + "' does not match the requested regular expression '" + regex + "'.");
}
}
} catch (PatternSyntaxException e) {
throw new RuntimeException("'" + regex + "' is not a valid regular expression", e);
} catch (RuntimeException e) {
throw e;
}
}
public static Object evaluateDefaultValue(BaseType baseType, String defaultValueAsString) {
if(defaultValueAsString.compareTo("null")==0) {
return null;
}
if(defaultValueAsString!=null) {
switch (baseType) {
case BOOLEAN:
return Boolean.parseBoolean(defaultValueAsString);
case INTEGER:
return Integer.parseInt(defaultValueAsString);
case SHORT:
return Short.parseShort(defaultValueAsString);
case LONG:
return Long.parseLong(defaultValueAsString);
case FLOAT:
return Float.parseFloat(defaultValueAsString);
case DOUBLE:
return Double.parseDouble(defaultValueAsString);
case DATE:
SimpleDateFormat sdf = new SimpleDateFormat(Element.DATETIME_PATTERN);
try {
return sdf.parse(defaultValueAsString);
} catch (ParseException e) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Error while parsing annotated default ");
stringBuffer.append(Date.class.getSimpleName());
stringBuffer.append(". The provided default value is '");
stringBuffer.append(defaultValueAsString);
stringBuffer.append("' which does not match the pattern '");
stringBuffer.append(Element.DATETIME_PATTERN);
stringBuffer.append("'.");
throw new RuntimeException(stringBuffer.toString(), e);
}
case STRING:
return defaultValueAsString;
case BINARY:
return defaultValueAsString.getBytes();
case BYTE:
return Byte.parseByte(defaultValueAsString);
case PROPERTY:
return null;
default:
return null;
}
}
return null;
}
public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) { public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) {
String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name(); String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name();
this.name = name; this.name = name;
@ -81,37 +157,32 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
} }
this.propertyTypeName = new PropertyTypeName(method); this.propertyTypeName = new PropertyTypeName(method);
this.defaultValue = propertyAnnotation.defaultValue();
evaluateDefaultValue(propertyTypeName.getBaseType(), defaultValue);
Class<?> clz = method.getReturnType(); Class<?> clz = method.getReturnType();
logger.trace("Return Type for method {} is {}", method, clz); logger.trace("Return Type for method {} is {}", method, clz);
if(!propertyAnnotation.regexpr().isEmpty()) this.regexp = propertyAnnotation.regexpr(); if(!propertyAnnotation.regexpr().isEmpty()) {
if(this.regexp==null || this.regexp.compareTo("")==0 ){ this.regexp = propertyAnnotation.regexpr();
if(Enum.class.isAssignableFrom(clz)){
Object[] constants = clz.getEnumConstants();
StringBuilder stringBuilder = new StringBuilder("^(");
for(int i=0; i<constants.length; i++){
stringBuilder.append(constants[i].toString());
if(i<constants.length-1){
stringBuilder.append("|");
}
}
stringBuilder.append(")$");
this.regexp = stringBuilder.toString();
}
if(UUID.class.isAssignableFrom(clz)){
this.regexp = UUID_REGEX;
}
if(URI.class.isAssignableFrom(clz)){
this.regexp = URI_REGEX;
}
if(URL.class.isAssignableFrom(clz)){
this.regexp = URL_REGEX;
}
if(Version.class.isAssignableFrom(clz)){
this.regexp = Version.VERSION_REGEX;
} }
if(propertyTypeName.getBaseType()!= BaseType.STRING && this.regexp!=null) {
throw new RuntimeException("You cannot provide a regex for property '" + name + "' if the type is not a String");
}
if(this.regexp==null || this.regexp.compareTo("")==0 ){
this.regexp = PropertyTypeName.getRegexByClass(clz);
}
if(this.regexp!=null) {
// Validate regex and the default value against regex (if any)
if(propertyTypeName.getBaseType()== BaseType.STRING && defaultValue!=null) {
checkRegex(regexp, (String) defaultValue);
}else {
checkRegex(regexp, null);
}
} }
} }

View File

@ -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.annotation.JsonIgnoreProperties;
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyBasicInfo;
import org.gcube.informationsystem.types.annotations.Final; import org.gcube.informationsystem.types.annotations.Final;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl;
@ -18,12 +18,10 @@ import org.gcube.informationsystem.utils.Version;
@TypeMetadata(name = PropertyDefinition.NAME, description = "This type provides information for the definition of any properties", version = Version.MINIMAL_VERSION_STRING) @TypeMetadata(name = PropertyDefinition.NAME, description = "This type provides information for the definition of any properties", 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)
@Final @Final
public interface PropertyDefinition extends PropertyElement, Comparable<PropertyDefinition> { public interface PropertyDefinition extends PropertyBasicInfo, Comparable<PropertyDefinition> {
public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName(); public static final String NAME = "PropertyDefinition"; // PropertyDefinition.class.getSimpleName();
public static final String NAME_PROPERTY = "name";
public static final String DESCRIPTION_PROPERTY = "description";
public static final String MANDATORY_PROPERTY = "mandatory"; public static final String MANDATORY_PROPERTY = "mandatory";
public static final String READ_ONLY_PROPERTY = "readonly"; public static final String READ_ONLY_PROPERTY = "readonly";
public static final String NOT_NULL_PROPERTY = "notnull"; public static final String NOT_NULL_PROPERTY = "notnull";
@ -32,12 +30,6 @@ public interface PropertyDefinition extends PropertyElement, Comparable<Property
public static final String REGEX_PROPERTY = "regexp"; public static final String REGEX_PROPERTY = "regexp";
public static final String PROPERTY_TYPE_PROPERTY = "propertyType"; public static final String PROPERTY_TYPE_PROPERTY = "propertyType";
@ISProperty(name = NAME_PROPERTY, readonly = true, mandatory = true, nullable = false)
public String getName();
@ISProperty(name = DESCRIPTION_PROPERTY, readonly = false, mandatory = true, nullable = false)
public String getDescription();
@ISProperty(name = MANDATORY_PROPERTY, readonly = false, mandatory = true, nullable = false) @ISProperty(name = MANDATORY_PROPERTY, readonly = false, mandatory = true, nullable = false)
public boolean isMandatory(); public boolean isMandatory();