Fixed code

This commit is contained in:
Luca Frosini 2024-06-10 11:51:30 +02:00
parent d9ab7b8ebe
commit 769853a113
4 changed files with 27 additions and 14 deletions

View File

@ -39,17 +39,17 @@ public class TemplateVariableImpl extends PropertyElementImpl implements Templat
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;
@ -113,7 +113,7 @@ public class TemplateVariableImpl extends PropertyElementImpl implements Templat
@Override
public String toString() {
return "PropertyDefinition ["
return "TemplateVariable ["
+ "name=" + name
+ ", description=" + description
+ ", max=" + max
@ -123,4 +123,5 @@ public class TemplateVariableImpl extends PropertyElementImpl implements Templat
+ ", defaultValue=" + (defaultValue == null ? "null" : defaultValue.toString())
+ "]";
}
}

View File

@ -18,18 +18,27 @@ import org.gcube.informationsystem.utils.Version;
public interface TemplateVariable extends PropertyElement, Attribute {
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)
@ISProperty(name = Attribute.NAME_PROPERTY, description = "The name of the Query Template Variable.", readonly = true, mandatory = true, nullable = false)
public String getName();
@ISProperty(name = VARIABLE_DESCRIPTION_PROPERTY, description = "The description of the Query Template Variable.", readonly = false, mandatory = true, nullable = false)
@ISProperty(name = Attribute.DESCRIPTION_PROPERTY, readonly = false, mandatory = true, nullable = false)
public String getDescription();
@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 = true)
@ISProperty(name = Attribute.MAX_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Integer getMax();
@ISProperty(name = Attribute.MIN_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Integer getMin();
@ISProperty(name = Attribute.REGEX_PROPERTY, readonly = false, mandatory = true, nullable = false)
public String getRegexp();
@ISProperty(name = Attribute.PROPERTY_TYPE_PROPERTY, readonly = false, mandatory = true, nullable = false)
public String getPropertyType();
@ISProperty(name = Attribute.DEFAULT_VALUE_PROPERTY, readonly = false, mandatory = false, nullable = true)
public Object getDefaultValue();
}

View File

@ -235,6 +235,9 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
return "PropertyDefinition ["
+ "name=" + name
+ ", description=" + description
+ ", mandatory=" + mandatory
+ ", readonly=" + readonly
+ ", notnull=" + notnull
+ ", max=" + max
+ ", min=" + min
+ ", regexpr=" + regexp

View File

@ -48,7 +48,7 @@ public class QueryTemplateTest {
stateTemplateVariable.setName(stateVariableName);
stateTemplateVariable.setDescription("StateFacet value");
stateTemplateVariable.setDefaultValue("running");
//stateTemplateVariable.setPropertyType("String");
stateTemplateVariable.setPropertyType("String");
queryTemplate.addTemplateVariable(stateTemplateVariable);
TemplateVariable nameTemplateVariable = new TemplateVariableImpl();
@ -56,7 +56,7 @@ public class QueryTemplateTest {
nameTemplateVariable.setName(nameVariableName);
nameTemplateVariable.setDescription("SoftwareFacet name");
nameTemplateVariable.setDefaultValue("resource-registry");
//nameTemplateVariable.setPropertyType("String");
nameTemplateVariable.setPropertyType("String");
queryTemplate.addTemplateVariable(nameTemplateVariable);
TemplateVariable groupTemplateVariable = new TemplateVariableImpl();
@ -64,7 +64,7 @@ public class QueryTemplateTest {
groupTemplateVariable.setName(groupVariableName);
groupTemplateVariable.setDescription("SoftwareFacet group");
groupTemplateVariable.setDefaultValue("information-system");
//groupTemplateVariable.setPropertyType("String");
groupTemplateVariable.setPropertyType("String");
queryTemplate.addTemplateVariable(groupTemplateVariable);
String json = ElementMapper.marshal(queryTemplate);