information-system-model/src/main/java/org/gcube/informationsystem/query/templates/reference/entities/QueryTemplate.java

64 lines
3.1 KiB
Java

package org.gcube.informationsystem.query.templates.reference.entities;
import java.util.Map;
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.databind.annotation.JsonDeserialize;
import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.query.templates.impl.entities.QueryTemplateImpl;
import org.gcube.informationsystem.query.templates.reference.properties.TemplateProperty;
import org.gcube.informationsystem.query.templates.reference.properties.TemplateVariable;
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)
*/
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonDeserialize(as=QueryTemplateImpl.class)
@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)
public interface QueryTemplate extends EntityElement {
public static final String NAME = "QueryTemplate"; //QueryTemplate.class.getSimpleName();
public static final String NAME_PROPERTY = "name";
public static final String DESCRIPTION_PROPERTY = "description";
public static final String TEMPLATE_PROPERTY = "template";
public static final String TEMPLATE_VARIABLES_PROPERTY = "templateVariables";
@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();
public void setName(String name);
@ISProperty(name = DESCRIPTION_PROPERTY, description = "The description of the Query Template.", readonly = false, mandatory = true, nullable = false)
public String getDescription();
public void setDescription(String description);
@JsonGetter(value = TEMPLATE_PROPERTY)
@ISProperty(name = TEMPLATE_PROPERTY, description = "The Query Template. It can contains query variables to be replaced to obtain a runnable query.", readonly = false, mandatory = true, nullable = false)
public TemplateProperty getTemplate();
@JsonIgnore
public void setTemplate(TemplateProperty templateProperty);
@JsonGetter(value = TEMPLATE_VARIABLES_PROPERTY)
@ISProperty(name = TEMPLATE_VARIABLES_PROPERTY, description = "The Query Template Variables. It can contains Query Template Variable to be replaced to obtain a runnable query.", readonly = false, mandatory = true, nullable = false)
public Map<String, TemplateVariable> getTemplateVariables();
@JsonIgnore
/**
* Adding variable which already exists, the previous value will be override.
* @param templateDefaultValue
*/
public void addTemplateVariable(TemplateVariable templateVariable);
}