Interface QueryTemplate

    • Method Detail

      • setName

        void setName​(String name)
        Sets the name of the query template.
        Parameters:
        name - The name to set.
      • setDescription

        void setDescription​(String description)
        Sets the description of the query template.
        Parameters:
        description - The description to set.
      • getTemplateAsString

        @ISProperty(name="template",
                    description="The Query Template. It can contains query variables to be replaced to obtain a runnable query.",
                    readonly=false,
                    mandatory=true,
                    nullable=false)
        String getTemplateAsString()
                            throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
        Returns the template body as a string.
        Returns:
        The template as a string.
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonProcessingException - if an error occurs during serialization.
      • setTemplate

        void setTemplate​(String template)
                  throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException,
                         IOException
        Sets the template body from a string.
        Parameters:
        template - The template string.
        Throws:
        IOException - if an error occurs during parsing.
        org.gcube.com.fasterxml.jackson.core.JsonProcessingException - if an error occurs during JSON processing.
      • setTemplate

        void setTemplate​(org.gcube.com.fasterxml.jackson.databind.JsonNode template)
        Sets the template body from a JsonNode.
        Parameters:
        template - The template as a JsonNode.
      • getTemplate

        org.gcube.com.fasterxml.jackson.databind.JsonNode getTemplate()
        Returns the template body as a JsonNode.
        Returns:
        The template as a JsonNode.
      • getTemplateVariables

        @ISProperty(name="templateVariables",
                    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)
        Map<String,​TemplateVariable> getTemplateVariables()
        Returns the variables defined in this template.
        Returns:
        A map of template variables, with variable names as keys.
      • addTemplateVariable

        void addTemplateVariable​(TemplateVariable templateVariable)
        Adds a variable to the template. If a variable with the same name already exists, it will be overridden.
        Parameters:
        templateVariable - The variable to add.
      • getParamsFromDefaultValues

        org.gcube.com.fasterxml.jackson.databind.node.ObjectNode getParamsFromDefaultValues()
        Creates an ObjectNode containing the default values of all template variables.
        Returns:
        An ObjectNode with default parameter values.
      • getJsonQuery

        org.gcube.com.fasterxml.jackson.databind.JsonNode getJsonQuery()
                                                                throws Exception
        Generates a runnable query by substituting variables with their default values.
        Returns:
        The generated query as a JsonNode.
        Throws:
        Exception - if an error occurs during query generation.
      • getJsonQuery

        org.gcube.com.fasterxml.jackson.databind.JsonNode getJsonQuery​(org.gcube.com.fasterxml.jackson.databind.JsonNode values)
                                                                throws Exception
        Generates a runnable query by substituting variables with the provided values.
        Parameters:
        values - A JsonNode containing the values to substitute.
        Returns:
        The generated query as a JsonNode.
        Throws:
        Exception - if an error occurs during query generation.