org.qi4j.index.sql.support.skeletons

## Class AbstractSQLQuerying

- java.lang.Object
- - org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying

- All Implemented Interfaces:
    SQLQuerying
  Direct Known Subclasses:
    PostgreSQLQuerying

      public abstract class AbstractSQLQuerying
      extends Object
      implements SQLQuerying

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `AbstractSQLQuerying.SQLBooleanCreator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSQLQuerying()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addTypeJoin(org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.builders.query.TableReferenceBuilder from, int startingIndex)`
    `String` | `constructQuery(Class<?> resultType, Specification<Composite> whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes, Boolean countOnly)` This method will be called when parsing needs to be done from Zest query to SQL query.
    `protected org.sql.generation.api.grammar.query.QuerySpecification` | `constructQueryForPredicate(Specification<Composite> predicate, PropertyFunction<?> propRef, org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef assoRef, Boolean includeLastAssoPathTable, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.WhereClauseProcessor whereClauseGenerator)`
    `protected org.sql.generation.api.grammar.booleans.BooleanExpression` | `createTypeCondition(Class<?> resultType, org.sql.generation.api.vendor.SQLVendor vendor)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `finalizeContainsQuery(org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.query.QuerySpecification contains, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Boolean negationActive)`
    `protected abstract org.sql.generation.api.grammar.query.QueryExpression` | `finalizeQuery(org.sql.generation.api.vendor.SQLVendor sqlVendor, org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder specBuilder, Class<?> resultType, Specification<Composite> whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes, Boolean countOnly)`
    `protected <ReturnType> ReturnType` | `findFromLookupTables(Map<Class<? extends Specification>,ReturnType> normal, Map<Class<? extends Specification>,ReturnType> negated, Specification<Composite> predicate, Boolean negationActive)`
    `protected org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder` | `getBuilderForPredicate(org.sql.generation.api.vendor.SQLVendor vendor, String tableAlias)`
    `protected List<Integer>` | `getEntityTypeIDs(Class<?> entityType)`
    `protected AbstractSQLQuerying.SQLBooleanCreator` | `getOperator(Specification<Composite> predicate)`
    `Integer` | `getResultSetType(Integer firstResult, Integer maxResults)`
    `protected org.sql.generation.api.grammar.query.joins.JoinType` | `getTableJoinStyle(Specification<Composite> predicate, Boolean negationActive)`
    `Boolean` | `isFirstResultSettingSupported()`
    `protected Integer` | `modifyFromClauseAndWhereClauseToGetValue(QualifiedName qName, Object value, Specification<Composite> predicate, Boolean negationActive, Integer currentTableIndex, org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.ModifiableInt maxTableIndex, String columnName, String collectionPath, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.builders.booleans.BooleanBuilder whereClause, org.sql.generation.api.grammar.builders.booleans.BooleanBuilder afterWhere, org.sql.generation.api.grammar.builders.query.TableReferenceBuilder fromClause, org.sql.generation.api.grammar.builders.query.GroupByBuilder groupBy, org.sql.generation.api.grammar.builders.booleans.BooleanBuilder having, List<org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.QNameJoin> qNameJoins, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processAssociationNotNullPredicate(AssociationNotNullSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processAssociationNullPredicate(AssociationNullSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processBooleanExpression(Specification<Composite> expression, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processComparisonPredicate(ComparisonSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processContainsAllPredicate(ContainsAllSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processContainsPredicate(ContainsSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processManyAssociationContainsPredicate(ManyAssociationContainsSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processMatchesPredicate(MatchesSpecification predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, Map<String,Object> variables, List<Object> values, List<Integer> valueSQLTypes)`
    `protected void` | `processOrderBySegments(OrderBy[] orderBy, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder builder)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processPropertyNotNullPredicate(PropertyNotNullSpecification<?> predicate, boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `processPropertyNullPredicate(PropertyNullSpecification<?> predicate, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)`
    `protected org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder` | `selectAllEntitiesOfCorrectType(org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)`
    `protected org.sql.generation.api.grammar.builders.query.QueryBuilder` | `singleQuery(Specification<Composite> predicate, PropertyFunction<?> propRef, org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef assoRef, Boolean includeLastAssoPathTable, Boolean negationActive, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition, org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.WhereClauseProcessor whereClauseGenerator)`
    `protected String` | `translateJavaRegexpToPGSQLRegexp(String javaRegexp)`
    `protected Integer` | `traverseAssociationPath(org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef reference, Integer lastTableIndex, Integer nextAvailableIndex, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.builders.query.TableReferenceBuilder builder, org.sql.generation.api.grammar.query.joins.JoinType joinStyle, Boolean includeLastTable)`
    `protected Integer` | `traversePropertyPath(PropertyFunction<?> reference, Integer lastTableIndex, Integer nextAvailableIndex, org.sql.generation.api.vendor.SQLVendor vendor, org.sql.generation.api.grammar.builders.query.TableReferenceBuilder builder, org.sql.generation.api.grammar.query.joins.JoinType joinStyle)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractSQLQuerying

          public AbstractSQLQuerying()

  - ### Method Detail

    - #### getResultSetType

          public Integer getResultSetType(Integer firstResult,
                                 Integer maxResults)

      Specified by:
        `getResultSetType` in interface `SQLQuerying`

    - #### isFirstResultSettingSupported

          public Boolean isFirstResultSettingSupported()

      Specified by:
        `isFirstResultSettingSupported` in interface `SQLQuerying`

    - #### constructQuery

          public String constructQuery(Class<?> resultType,
                              Specification<Composite> whereClause,
                              OrderBy[] orderBySegments,
                              Integer firstResult,
                              Integer maxResults,
                              Map<String,Object> variables,
                              List<Object> values,
                              List<Integer> valueSQLTypes,
                              Boolean countOnly)
                                throws EntityFinderException

      Description copied from interface: `SQLQuerying`
      This method will be called when parsing needs to be done from Zest query to SQL query. This method is supposed to return one single SQL query, which can be used with `PreparedStatement`.
      Specified by:
        `constructQuery` in interface `SQLQuerying`
      Parameters:
        `resultType` - The result type of Zest query.
        `whereClause` - The where clause of Zest query.
        `orderBySegments` - The order by segments of Zest query.
        `firstResult` - The first result index of Zest query.
        `maxResults` - The max amount of returned results.
        `values` - Values to put into `PreparedStatement`, in the order of the list. This List is created from the outside and this method is supposed to fill it with necessary values, if any.
        `valueSQLTypes` - The SQL types of the objects in `values`. Each SQL type at index `x` is interpreted as type of value at index `x` of the `values` -list.
        `countOnly` - True if this query should return only the number of matching entities, false otherwise.
      Returns:
        The SQL query, which may be used with `PreparedStatement`.
      Throws:
        `EntityFinderException` - If SQLException or something else bad happens.

    - #### createTypeCondition

          protected org.sql.generation.api.grammar.booleans.BooleanExpression createTypeCondition(Class<?> resultType,
                                                                                      org.sql.generation.api.vendor.SQLVendor vendor)

    - #### finalizeQuery

          protected abstract org.sql.generation.api.grammar.query.QueryExpression finalizeQuery(org.sql.generation.api.vendor.SQLVendor sqlVendor,
                                                                           org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder specBuilder,
                                                                           Class<?> resultType,
                                                                           Specification<Composite> whereClause,
                                                                           OrderBy[] orderBySegments,
                                                                           Integer firstResult,
                                                                           Integer maxResults,
                                                                           Map<String,Object> variables,
                                                                           List<Object> values,
                                                                           List<Integer> valueSQLTypes,
                                                                           Boolean countOnly)

    - #### processBooleanExpression

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processBooleanExpression(Specification<Composite> expression,
                                                                                            Boolean negationActive,
                                                                                            org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                            org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                            Map<String,Object> variables,
                                                                                            List<Object> values,
                                                                                            List<Integer> valueSQLTypes)

    - #### selectAllEntitiesOfCorrectType

          protected org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder selectAllEntitiesOfCorrectType(org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                               org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)

    - #### processMatchesPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processMatchesPredicate(MatchesSpecification predicate,
                                                                                           Boolean negationActive,
                                                                                           org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                           org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                           Map<String,Object> variables,
                                                                                           List<Object> values,
                                                                                           List<Integer> valueSQLTypes)

    - #### processComparisonPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processComparisonPredicate(ComparisonSpecification<?> predicate,
                                                                                              Boolean negationActive,
                                                                                              org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                              org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                              Map<String,Object> variables,
                                                                                              List<Object> values,
                                                                                              List<Integer> valueSQLTypes)

    - #### processManyAssociationContainsPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processManyAssociationContainsPredicate(ManyAssociationContainsSpecification<?> predicate,
                                                                                                           Boolean negationActive,
                                                                                                           org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                           org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                                           Map<String,Object> variables,
                                                                                                           List<Object> values,
                                                                                                           List<Integer> valueSQLTypes)

    - #### processPropertyNullPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processPropertyNullPredicate(PropertyNullSpecification<?> predicate,
                                                                                                Boolean negationActive,
                                                                                                org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)

    - #### processPropertyNotNullPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processPropertyNotNullPredicate(PropertyNotNullSpecification<?> predicate,
                                                                                                   boolean negationActive,
                                                                                                   org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                   org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)

    - #### processAssociationNullPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processAssociationNullPredicate(AssociationNullSpecification<?> predicate,
                                                                                                   Boolean negationActive,
                                                                                                   org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                   org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)

    - #### processAssociationNotNullPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processAssociationNotNullPredicate(AssociationNotNullSpecification<?> predicate,
                                                                                                      Boolean negationActive,
                                                                                                      org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                      org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition)

    - #### processContainsPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processContainsPredicate(ContainsSpecification<?> predicate,
                                                                                            Boolean negationActive,
                                                                                            org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                            org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                            Map<String,Object> variables,
                                                                                            List<Object> values,
                                                                                            List<Integer> valueSQLTypes)

    - #### finalizeContainsQuery

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder finalizeContainsQuery(org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                         org.sql.generation.api.grammar.query.QuerySpecification contains,
                                                                                         org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                         Boolean negationActive)

    - #### processContainsAllPredicate

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder processContainsAllPredicate(ContainsAllSpecification<?> predicate,
                                                                                               Boolean negationActive,
                                                                                               org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                               org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                               Map<String,Object> variables,
                                                                                               List<Object> values,
                                                                                               List<Integer> valueSQLTypes)

    - #### singleQuery

          protected org.sql.generation.api.grammar.builders.query.QueryBuilder singleQuery(Specification<Composite> predicate,
                                                                               PropertyFunction<?> propRef,
                                                                               org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef assoRef,
                                                                               Boolean includeLastAssoPathTable,
                                                                               Boolean negationActive,
                                                                               org.sql.generation.api.vendor.SQLVendor vendor,
                                                                               org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                               org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.WhereClauseProcessor whereClauseGenerator)

    - #### constructQueryForPredicate

          protected org.sql.generation.api.grammar.query.QuerySpecification constructQueryForPredicate(Specification<Composite> predicate,
                                                                                           PropertyFunction<?> propRef,
                                                                                           org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef assoRef,
                                                                                           Boolean includeLastAssoPathTable,
                                                                                           Boolean negationActive,
                                                                                           org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                           org.sql.generation.api.grammar.booleans.BooleanExpression entityTypeCondition,
                                                                                           org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.WhereClauseProcessor whereClauseGenerator)

    - #### addTypeJoin

          protected void addTypeJoin(org.sql.generation.api.vendor.SQLVendor vendor,
                         org.sql.generation.api.grammar.builders.query.TableReferenceBuilder from,
                         int startingIndex)

    - #### getOperator

          protected AbstractSQLQuerying.SQLBooleanCreator getOperator(Specification<Composite> predicate)

    - #### getTableJoinStyle

          protected org.sql.generation.api.grammar.query.joins.JoinType getTableJoinStyle(Specification<Composite> predicate,
                                                                              Boolean negationActive)

    - #### findFromLookupTables

          protected <ReturnType> ReturnType findFromLookupTables(Map<Class<? extends Specification>,ReturnType> normal,
                                                     Map<Class<? extends Specification>,ReturnType> negated,
                                                     Specification<Composite> predicate,
                                                     Boolean negationActive)

    - #### getBuilderForPredicate

          protected org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder getBuilderForPredicate(org.sql.generation.api.vendor.SQLVendor vendor,
                                                                                                       String tableAlias)

    - #### translateJavaRegexpToPGSQLRegexp

          protected String translateJavaRegexpToPGSQLRegexp(String javaRegexp)

    - #### processOrderBySegments

          protected void processOrderBySegments(OrderBy[] orderBy,
                                    org.sql.generation.api.vendor.SQLVendor vendor,
                                    org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder builder)

    - #### traversePropertyPath

          protected Integer traversePropertyPath(PropertyFunction<?> reference,
                                     Integer lastTableIndex,
                                     Integer nextAvailableIndex,
                                     org.sql.generation.api.vendor.SQLVendor vendor,
                                     org.sql.generation.api.grammar.builders.query.TableReferenceBuilder builder,
                                     org.sql.generation.api.grammar.query.joins.JoinType joinStyle)

    - #### traverseAssociationPath

          protected Integer traverseAssociationPath(org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.TraversedAssoOrManyAssoRef reference,
                                        Integer lastTableIndex,
                                        Integer nextAvailableIndex,
                                        org.sql.generation.api.vendor.SQLVendor vendor,
                                        org.sql.generation.api.grammar.builders.query.TableReferenceBuilder builder,
                                        org.sql.generation.api.grammar.query.joins.JoinType joinStyle,
                                        Boolean includeLastTable)

    - #### getEntityTypeIDs

          protected List<Integer> getEntityTypeIDs(Class<?> entityType)

    - #### modifyFromClauseAndWhereClauseToGetValue

          protected Integer modifyFromClauseAndWhereClauseToGetValue(QualifiedName qName,
                                                         Object value,
                                                         Specification<Composite> predicate,
                                                         Boolean negationActive,
                                                         Integer currentTableIndex,
                                                         org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.ModifiableInt maxTableIndex,
                                                         String columnName,
                                                         String collectionPath,
                                                         org.sql.generation.api.vendor.SQLVendor vendor,
                                                         org.sql.generation.api.grammar.builders.booleans.BooleanBuilder whereClause,
                                                         org.sql.generation.api.grammar.builders.booleans.BooleanBuilder afterWhere,
                                                         org.sql.generation.api.grammar.builders.query.TableReferenceBuilder fromClause,
                                                         org.sql.generation.api.grammar.builders.query.GroupByBuilder groupBy,
                                                         org.sql.generation.api.grammar.builders.booleans.BooleanBuilder having,
                                                         List<org.qi4j.index.sql.support.skeletons.AbstractSQLQuerying.QNameJoin> qNameJoins,
                                                         Map<String,Object> variables,
                                                         List<Object> values,
                                                         List<Integer> valueSQLTypes)