Class AbstractQueryBuilder

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.data.builder.AbstractQueryBuilder
All Implemented Interfaces:
QueryBuilder, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
QueueBuilder, ServiceBuilder, SQLBuilder

public abstract class AbstractQueryBuilder extends ServiceConfig implements QueryBuilder
Abstract query builder
  • Field Details

    • queryUtil

      protected final QueryUtil queryUtil
    • parameters

      protected com.fasterxml.jackson.databind.node.ObjectNode parameters
    • variables

      protected Map<String,QueryParameter> variables
    • variableIndex

      protected Integer variableIndex
    • componentSortList

      protected List<SortColumn> componentSortList
  • Constructor Details

    • AbstractQueryBuilder

      public AbstractQueryBuilder(QueryUtil queryUtil)
      Autowired constructor
      Parameters:
      queryUtil - Query utilities
  • Method Details

    • getVariables

      public Map<String,QueryParameter> getVariables() throws AWException
      Retrieve query generated variables
      Specified by:
      getVariables in interface QueryBuilder
      Returns:
      Query parameters
      Throws:
      AWException - Error retrieving query parameters
    • setVariables

      public AbstractQueryBuilder setVariables(Map<String,QueryParameter> parameterMap)
      Set variables
      Specified by:
      setVariables in interface QueryBuilder
      Parameters:
      parameterMap - Parameter map
      Returns:
      this
    • addComponentSort

      protected void addComponentSort(com.fasterxml.jackson.databind.node.ArrayNode sortList)
      Generate the sortlist from component sort
      Parameters:
      sortList - Component sort
    • getVariableAsString

      protected String getVariableAsString(com.fasterxml.jackson.databind.JsonNode varValue)
      Generic variable value call
      Parameters:
      varValue - Variable
      Returns:
      Variable as string
    • extractValuesFromParameters

      protected Map<String,Object> extractValuesFromParameters(Map<String,QueryParameter> variables)
      Extracts all values inside QueryParameters to use as arguments while calling the service
      Parameters:
      variables - query's variable map
      Returns:
      map with values extracted
    • transformFromJsonNode

      protected Object transformFromJsonNode(QueryParameter param)
      Get parameter from JSON
      Parameters:
      param - Parameter
      Returns:
      Object