Class SQLBuilder

All Implemented Interfaces:
QueryBuilder, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
SQLMaintainBuilder, SQLQueryBuilder

public abstract class SQLBuilder extends AbstractQueryBuilder
Generates sql codes
  • Constructor Details

    • SQLBuilder

      protected SQLBuilder(QueryUtil queryUtil, EncodeService encodeService)
      Autowired constructor
      Parameters:
      queryUtil - Query utilities
      encodeService - Encode service
  • Method Details

    • getFactory

      protected com.querydsl.sql.SQLQueryFactory getFactory()
      Retrieve sql factory
      Returns:
      SQL Factory
    • setFactory

      public SQLBuilder setFactory(com.querydsl.sql.SQLQueryFactory factory)
      Sets the SQLQueryFactory used by QueryDSL to create the SQLQuery
      Parameters:
      factory - Factory
      Returns:
      this
    • getSubquery

      protected com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> getSubquery(String queryId) throws AWException
      Generates a SQLQuery as a subquery
      Parameters:
      queryId - Id of the query to generate
      Returns:
      subquery
      Throws:
      AWException - Error retrieving subquery
    • getFieldExpression

      protected com.querydsl.core.types.Expression getFieldExpression(Field field) throws AWException
      Retrieve field expression
      Parameters:
      field - Field to retrieve
      Returns:
      Expression field expression
      Throws:
      AWException - Error retrieving field expression
    • getSimpleFieldExpression

      protected com.querydsl.core.types.Expression getSimpleFieldExpression(String table, String field, String function)
      Retrieve field expression from table, field and function
      Parameters:
      table - table
      field - field
      function - function
      Returns:
      Field expression
    • getConstantExpression

      protected com.querydsl.core.types.Expression getConstantExpression(Constant field) throws AWException
      Retrieve field expression
      Parameters:
      field - Field to retrieve
      Returns:
      Expression field expression
      Throws:
      AWException - Error retrieving field expression
    • getVariableExpression

      protected com.querydsl.core.types.Expression getVariableExpression(String variableName) throws AWException
      Retrieve a single variable as an Expression
      Parameters:
      variableName - Variable name
      Returns:
      Expression
      Throws:
      AWException
    • getFieldAliasExpression

      protected com.querydsl.core.types.Expression getFieldAliasExpression(SqlField field, String table)
      Retrieve field expression
      Parameters:
      field - Field to retrieve
      table - Table of the field
      Returns:
      Expression field expression
    • getOperationExpression

      protected com.querydsl.core.types.Expression getOperationExpression(Operation operation) throws AWException
      Retrieve operation expression
      Parameters:
      operation - Operation to manage
      Returns:
      Expression concat expression
      Throws:
      AWException
    • generateOperationExpression

      protected com.querydsl.core.types.Expression generateOperationExpression(Operation operation, com.querydsl.core.types.Expression... operands)
      Apply operand into operation
      Parameters:
      operation - Operation
      operands - Operand list
      Returns:
      Operation expression
    • getOperandExpression

      protected com.querydsl.core.types.Expression getOperandExpression(SqlField operand) throws AWException
      Retrieve operand template
      Parameters:
      operand - Operand to retrieve template
      Returns:
      Expression concat expression
      Throws:
      AWException
    • getSqlFieldExpression

      protected com.querydsl.core.types.Expression getSqlFieldExpression(SqlField field) throws AWException
      Retrieve operand template
      Parameters:
      field - Operand to retrieve template
      Returns:
      Expression concat expression
      Throws:
      AWException
    • getCaseExpression

      protected com.querydsl.core.types.Expression getCaseExpression(Case field) throws AWException
      Retrieve case expression
      Parameters:
      field - Field to apply the case when condition
      Returns:
      Expression caseWhen expression
      Throws:
      AWException
    • getOverExpression

      protected com.querydsl.core.types.Expression getOverExpression(Over field) throws AWException
      Retrieve over expression
      Parameters:
      field - Field to apply the case when condition
      Returns:
      Expression caseWhen expression
      Throws:
      AWException
    • getOrderByExpression

      protected com.querydsl.core.types.OrderSpecifier getOrderByExpression(OrderBy orderBy)
      Retrieve order by expression
      Parameters:
      orderBy - Order by
      Returns:
      Expression
    • getTableExpression

      protected Object getTableExpression(Table table, boolean withAlias) throws AWException
      Retrieve table expression
      Parameters:
      table - Table
      Returns:
      Table expression
      Throws:
      AWException - Error generating table expression
    • getTable

      protected com.querydsl.sql.RelationalPath getTable(Table table, boolean withAlias)
      Get table expression with schema
      Parameters:
      table - Table
      Returns:
      Table expression
    • getVariableAsExpression

      protected com.querydsl.core.types.Expression getVariableAsExpression(String value, ParameterType type) throws AWException
      Generate variable for parameter
      Parameters:
      value - Variable value
      type - Variable type
      Returns:
      Variable as expression
      Throws:
      AWException - Variable replacement was wrong
    • getVariableAsExpressionOrEmpty

      protected com.querydsl.core.types.Expression getVariableAsExpressionOrEmpty(String value, ParameterType type) throws AWException
      Generate variable for parameter
      Parameters:
      value - Variable value
      type - Variable type
      Returns:
      Variable as expression
      Throws:
      AWException - Variable replacement was wrong
    • getVariableAsExpressionOrNull

      protected com.querydsl.core.types.Expression getVariableAsExpressionOrNull(String value, ParameterType type)
      Generate variable for parameter
      Parameters:
      value - Variable value
      type - Variable type
      Returns:
      Variable as expression
    • getExpressionFunction

      protected com.querydsl.core.types.Expression getExpressionFunction(com.querydsl.core.types.Expression fieldExpression, String function)
      Add function to expression
      Parameters:
      fieldExpression - Current field expression
      function - Function
      Returns:
      Expression
    • getExpressionCast

      protected com.querydsl.core.types.Expression getExpressionCast(com.querydsl.core.types.Expression fieldExpression, String cast)
      Add cast to expression
      Parameters:
      fieldExpression - Current field expression
      cast - Function
      Returns:
      Expression
    • getFilterGroups

      protected com.querydsl.core.types.dsl.BooleanExpression getFilterGroups(FilterGroup group) throws AWException
      Adds filter groups conditions
      Parameters:
      group - FilterGroup to add
      Returns:
      BooleanExpression result of filter
      Throws:
      AWException - Filter group statement generation error
    • getStringExpression

      protected com.querydsl.core.types.Expression getStringExpression(String value)
      Retrieve string expression with quotes
      Parameters:
      value - String value
      Returns:
      String expression with quotes
    • buildPath

      protected com.querydsl.core.types.dsl.SimpleExpression<Object> buildPath(String parent, String node, String alias)
      Build a path with pathbuilder
      Parameters:
      parent - Parent
      node - Node
      alias - Alias
      Returns:
      Field path
    • buildPath

      protected com.querydsl.core.types.dsl.PathBuilder<Object> buildPath(String parent, String node)
      Build a path with pathbuilder
      Parameters:
      parent - Parent node
      node - Node
      Returns:
      path
    • buildPath

      protected com.querydsl.core.types.dsl.PathBuilder<Object> buildPath(String node)
      Build a path with pathbuilder
      Parameters:
      node - Node
      Returns:
      path