Class SQLQueryBuilder

  • All Implemented Interfaces:
    QueryBuilder, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class SQLQueryBuilder
    extends SQLBuilder
    Generates sql codes
    • Constructor Detail

      • SQLQueryBuilder

        public SQLQueryBuilder​(QueryUtil queryUtil,
                               EncodeService encodeService)
        Autowired constructor
        Parameters:
        queryUtil - Query utilities
        encodeService - Encode service
    • Method Detail

      • setComponentSort

        public SQLQueryBuilder setComponentSort​(com.fasterxml.jackson.databind.node.ArrayNode sortList)
        Generate the sortlist from component sort
        Parameters:
        sortList - Component sort
        Returns:
        this
      • setQuery

        public SQLQueryBuilder setQuery​(Query query)
        Description copied from interface: QueryBuilder
        Set query
        Parameters:
        query - Query
        Returns:
        query builder
      • setFactory

        public SQLQueryBuilder setFactory​(com.querydsl.sql.SQLQueryFactory factory)
        Description copied from class: SQLBuilder
        Sets the SQLQueryFactory used by QueryDSL to create the SQLQuery
        Overrides:
        setFactory in class SQLBuilder
        Parameters:
        factory - Factory
        Returns:
        this
      • setParameters

        public SQLQueryBuilder setParameters​(com.fasterxml.jackson.databind.node.ObjectNode parameters)
      • queryForCount

        public SQLQueryBuilder queryForCount()
        Set query for count only
        Returns:
        this
      • build

        public com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> build()
                                                                 throws AWException
        Builds the SQLQuery
        Returns:
        SQLQuery prepared for fetch
        Throws:
        AWException - Error building query
      • getFields

        protected com.querydsl.core.types.Expression[] getFields()
                                                          throws AWException
        Forms the Expressions for the SELECT operation
        Returns:
        Expression[] expressions
        Throws:
        AWException - Error retrieving fields
      • getFieldsAlias

        protected com.querydsl.core.types.Expression[] getFieldsAlias​(String table)
        Forms the Expressions for the SELECT operation
        Parameters:
        table - Field table
        Returns:
        Expression[] expressions
      • getTables

        protected com.querydsl.core.types.Expression[] getTables()
                                                          throws AWException
        Forms the Expressions for the FROM operation
        Returns:
        Expression[] expressions
        Throws:
        AWException - Error retrieving tables
      • doWhere

        protected void doWhere​(com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> finalQuery)
                        throws AWException
        Adds WHERE operations to the SQLQuery
        Parameters:
        finalQuery - SQLQuery created in build method
        Throws:
        AWException - Where statement generation error