Package io.jmix.data

Interface QueryTransformer

All Known Implementing Classes:
QueryTransformerAstBased

public interface QueryTransformer
Transforms JPQL query
  • Field Details

  • Method Details

    • addWhere

      void addWhere(String where)
      Adds 'where' clause replacing entity alias
    • addWhereAsIs

      void addWhereAsIs(String where)
      Adds 'where' clause
    • addJoinAndWhere

      void addJoinAndWhere(String join, String where)
      Adds 'join' and 'where' clauses. Replaces alias in 'join' but doesn't replace it in 'where'
    • replaceOrderByExpressions

      @Deprecated void replaceOrderByExpressions(boolean directionDesc, String... sortExpressions)
      Deprecated.
    • replaceOrderByExpressions

      void replaceOrderByExpressions(Map<String,Sort.Direction> sortExpressions)
      Adds or replaces 'order by' clause
    • addFirstSelectionSource

      void addFirstSelectionSource(String selection)
    • replaceWithCount

      void replaceWithCount()
      Replaces select e.f1, e.f2, ... clause with select count(e) ...
    • replaceWithSelectId

      void replaceWithSelectId(String pkName)
      Replaces select e from ... clause with select e.pkName from ...
    • replaceWithSelectEntityVariable

      void replaceWithSelectEntityVariable(String selectEntityVariable)
      Replaces select e from ... clause with select 'selectEntityVariable' from ...
    • removeDistinct

      boolean removeDistinct()
      Replaces 'select distinct' with 'select'.
      Returns:
      true if 'distinct' was really removed, false if there was no 'distinct' in the query
    • addDistinct

      void addDistinct()
      Replaces 'select' with 'select distinct'.
    • addOrderByIdIfNotExists

      void addOrderByIdIfNotExists(String idProperty)
      Adds 'order by' clause if it doesn't exists
    • addEntityInGroupBy

      void addEntityInGroupBy(String entityAlias)
      Adds @param entityAlias to 'group by' clause
    • removeOrderBy

      void removeOrderBy()
      Removes 'order by' clause
    • replaceEntityName

      void replaceEntityName(String newName)
      Replace main entity name, e.g. "select d ref$Driver d" with "select d ref$ExtDriver d"
    • reset

      void reset()
      Reset internal buffer
    • getResult

      String getResult()
      Get buffer
    • getAddedParams

      Set<String> getAddedParams()
      Get parameter names found during transformation
    • handleCaseInsensitiveParam

      void handleCaseInsensitiveParam(String paramName)
    • replaceInCondition

      void replaceInCondition(String paramName)
    • addJoin

      default void addJoin(String join)
      Adds 'join' clause
    • replaceIsNullStatements

      default boolean replaceIsNullStatements(String paramName, boolean isNullValue)
      Replace all is null and is not null statements with provided parameter
      Parameters:
      paramName - name of the parameter
      isNullValue - is parameter value null
      Returns:
      true if at least one statement was replaced, false otherwise