Improving classes to support query templates
This commit is contained in:
parent
833b2f5805
commit
05b6b65fee
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.informationsystem.querytemplates.impl.entities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -33,10 +34,11 @@ public class QueryTemplatesImpl implements QueryTemplate {
|
|||
protected Map<TypeVersion, String> changelog;
|
||||
|
||||
protected TemplateProperty templateProperty;
|
||||
protected Set<TemplateVariable> templateVariables;
|
||||
protected Set<TemplateVariable> templateDefaultValues;
|
||||
|
||||
public QueryTemplatesImpl() {
|
||||
this.changelog = new HashMap<>();
|
||||
this.templateDefaultValues = new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,18 +143,18 @@ public class QueryTemplatesImpl implements QueryTemplate {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<TemplateVariable> getQueryTemplatesVariables() {
|
||||
return templateVariables;
|
||||
public Set<TemplateVariable> getQueryTemplateDefaultValues() {
|
||||
return templateDefaultValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueryTemplateVariables(Set<TemplateVariable> templateVariables) {
|
||||
this.templateVariables = templateVariables;
|
||||
public void setQueryTemplateDefaultValues(Set<TemplateVariable> queryTemplateDefaultValues) {
|
||||
this.templateDefaultValues = queryTemplateDefaultValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueryTemplateVariable(TemplateVariable templateVariable) {
|
||||
this.templateVariables.add(templateVariable);
|
||||
public void addQueryTemplateDefaultValues(TemplateVariable queryTemplateDefaultValue) {
|
||||
this.templateDefaultValues.add(queryTemplateDefaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonGetter;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.querytemplates.impl.entities.QueryTemplatesImpl;
|
||||
|
@ -38,7 +38,7 @@ public interface QueryTemplate extends IdentifiableElement {
|
|||
public static final String CHANGELOG_PROPERTY = "changelog";
|
||||
|
||||
public static final String QUERY_TEMPLATE_PROPERTY = "queryTemplate";
|
||||
public static final String QUERY_VARIABLES_PROPERTY = "queryVariables";
|
||||
public static final String QUERY_TEMPLATE_DEFAULT_VALUES_PROPERTY = "queryTemplateDefaultValues";
|
||||
|
||||
@ISProperty(name = NAME_PROPERTY, description = "The name of the Query Template. Among UUID univocally identifiy the Query Template.", readonly = true, mandatory = true, nullable = false)
|
||||
public String getName();
|
||||
|
@ -90,13 +90,13 @@ public interface QueryTemplate extends IdentifiableElement {
|
|||
@JsonIgnore
|
||||
public void setQueryTemplate(TemplateProperty templateProperty);
|
||||
|
||||
@JsonGetter(value = QUERY_VARIABLES_PROPERTY)
|
||||
public Set<TemplateVariable> getQueryTemplatesVariables();
|
||||
@JsonGetter(value = QUERY_TEMPLATE_DEFAULT_VALUES_PROPERTY)
|
||||
public Set<TemplateVariable> getQueryTemplateDefaultValues();
|
||||
|
||||
@JsonIgnore
|
||||
public void setQueryTemplateVariables(Set<TemplateVariable> templateVariables);
|
||||
public void setQueryTemplateDefaultValues(Set<TemplateVariable> queryTemplateDefaultValues);
|
||||
|
||||
@JsonIgnore
|
||||
public void addQueryTemplateVariable(TemplateVariable templateVariables);
|
||||
public void addQueryTemplateDefaultValues(TemplateVariable queryTemplateDefaultValue);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.querytemplates.reference.properties;
|
|||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.querytemplates.impl.properties.TemplatePropertyImpl;
|
||||
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.TypeVersion;
|
||||
|
@ -18,10 +19,22 @@ public interface TemplateVariable extends PropertyElement {
|
|||
public static final String NAME = "TemplateVariable"; // TemplateVariable.class.getSimpleName();
|
||||
|
||||
public static final String VARIABLE_NAME_PROPERTY = "name";
|
||||
public static final String VARIABLE_TYPE_PROPERTY = "type";
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue