Class QueryTemplateImpl
- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.entities.EntityElementImpl
-
- org.gcube.informationsystem.queries.templates.impl.entities.QueryTemplateImpl
-
- All Implemented Interfaces:
Serializable,Element,EntityElement,IdentifiableElement,QueryTemplate
public class QueryTemplateImpl extends EntityElementImpl implements QueryTemplate
- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringdescriptionprotected Stringnameprotected org.gcube.com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected org.gcube.com.fasterxml.jackson.databind.JsonNodeparamsprotected org.gcube.com.fasterxml.jackson.databind.JsonNodetemplateprotected Map<String,TemplateVariable>templateVariables-
Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuid
-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
NAME
-
Fields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate
DESCRIPTION_PROPERTY, NAME, NAME_PROPERTY, TEMPLATE_PROPERTY, TEMPLATE_VARIABLES_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description QueryTemplateImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTemplateVariable(TemplateVariable templateVariable)StringgetDescription()org.gcube.com.fasterxml.jackson.databind.JsonNodegetJsonQuery()org.gcube.com.fasterxml.jackson.databind.JsonNodegetJsonQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode values)StringgetName()org.gcube.com.fasterxml.jackson.databind.node.ObjectNodegetParamsFromDefaultValues()Create an ObjectNode which can be used as parameters to obtain a JSON Query from the Query Template.org.gcube.com.fasterxml.jackson.databind.JsonNodegetTemplate()StringgetTemplateAsString()Map<String,TemplateVariable>getTemplateVariables()protected org.gcube.com.fasterxml.jackson.databind.JsonNodereplaceVariables(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)voidsetDescription(String description)voidsetName(String name)voidsetTemplate(String template)voidsetTemplate(org.gcube.com.fasterxml.jackson.databind.JsonNode template)-
Methods inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
getID, getMetadata, setID, setMetadata, toString
-
Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Methods inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadata
-
-
-
-
Field Detail
-
name
protected String name
-
description
protected String description
-
objectMapper
protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
template
protected org.gcube.com.fasterxml.jackson.databind.JsonNode template
-
templateVariables
protected Map<String,TemplateVariable> templateVariables
-
params
protected org.gcube.com.fasterxml.jackson.databind.JsonNode params
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceQueryTemplate
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceQueryTemplate
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceQueryTemplate
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfaceQueryTemplate
-
getTemplateAsString
public String getTemplateAsString() throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
- Specified by:
getTemplateAsStringin interfaceQueryTemplate- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException
-
setTemplate
public void setTemplate(String template) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException
- Specified by:
setTemplatein interfaceQueryTemplate- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingExceptionIOException
-
getTemplate
public org.gcube.com.fasterxml.jackson.databind.JsonNode getTemplate()
- Specified by:
getTemplatein interfaceQueryTemplate
-
setTemplate
public void setTemplate(org.gcube.com.fasterxml.jackson.databind.JsonNode template)
- Specified by:
setTemplatein interfaceQueryTemplate
-
getTemplateVariables
public Map<String,TemplateVariable> getTemplateVariables()
- Specified by:
getTemplateVariablesin interfaceQueryTemplate
-
addTemplateVariable
public void addTemplateVariable(TemplateVariable templateVariable)
- Specified by:
addTemplateVariablein interfaceQueryTemplate
-
getParamsFromDefaultValues
public org.gcube.com.fasterxml.jackson.databind.node.ObjectNode getParamsFromDefaultValues()
Description copied from interface:QueryTemplateCreate an ObjectNode which can be used as parameters to obtain a JSON Query from the Query Template. It uses the default values provided in TemplateVariables.- Specified by:
getParamsFromDefaultValuesin interfaceQueryTemplate- Returns:
- the created object node
-
getJsonQuery
public org.gcube.com.fasterxml.jackson.databind.JsonNode getJsonQuery() throws Exception- Specified by:
getJsonQueryin interfaceQueryTemplate- Returns:
- the JsonQuery replacing the variables using the default values contained in TemplateVariables
- Throws:
Exception
-
replaceVariables
protected org.gcube.com.fasterxml.jackson.databind.JsonNode replaceVariables(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws Exception- Throws:
Exception
-
getJsonQuery
public org.gcube.com.fasterxml.jackson.databind.JsonNode getJsonQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode values) throws Exception- Specified by:
getJsonQueryin interfaceQueryTemplate- Returns:
- the JsonQuery replacing the variables using the provided values
- Throws:
Exception
-
-