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

104 lines
4.5 KiB
Java

package org.gcube.informationsystem.querytemplates.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.annotation.JsonInclude;
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.base.reference.entities.EntityElement;
import org.gcube.informationsystem.querytemplates.impl.entities.QueryTemplateImpl;
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateProperty;
import org.gcube.informationsystem.querytemplates.reference.properties.TemplateVariable;
import org.gcube.informationsystem.types.annotations.Abstract;
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)
*/
@Abstract
@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 IdentifiableElement, 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 VERSION_PROPERTY = "version";
public static final String CHANGELOG_PROPERTY = "changelog";
public static final String QUERY_TEMPLATE_PROPERTY = "queryTemplate";
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();
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);
@JsonIgnore
public Version getVersion();
public void setVersion(Version typeVersion);
@JsonGetter(value = VERSION_PROPERTY)
@ISProperty(name = VERSION_PROPERTY, description = "The version of the Query Template.", readonly = false, mandatory = true, nullable = false)
public String getVersionAsString();
@JsonSetter(value = VERSION_PROPERTY)
public void setVersion(String version);
@JsonIgnore
public Map<Version, String> getChangelog();
@JsonIgnore
public void setChangelog(Map<Version, String> changelog);
@JsonIgnore
public void addChangelog(Version version, String changeDescription);
@JsonGetter(value = CHANGELOG_PROPERTY)
@JsonInclude(Include.NON_NULL)
@ISProperty(name = CHANGELOG_PROPERTY, description = "Provides the changelog of changes made to the Query Temaplate.", readonly = false, mandatory = true, nullable = false)
public Map<String, String> getChangelogWithVersionAsString();
@JsonIgnore
@JsonSetter(value=CHANGELOG_PROPERTY)
public void setChangelogWithVersionAsString(Map<String, String> changelog);
@JsonIgnore
public void addChangelog(String version, String changeDescription);
@JsonGetter(value = QUERY_TEMPLATE_PROPERTY)
@ISProperty(name = QUERY_TEMPLATE_PROPERTY, description = "The Query Template. It can contains QueryVariable 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 = QUERY_TEMPLATE_DEFAULT_VALUES_PROPERTY)
public Map<String, TemplateVariable> getTemplateVariables();
@JsonIgnore
/**
* Adding variable which already exists, the previous value will be override.
* @param templateDefaultValue
*/
public void addTemplateVariable(TemplateVariable templateVariable);
}