Package io.jmix.data
Interface QueryTransformer
- All Known Implementing Classes:
QueryTransformerAstBased
public interface QueryTransformer
Transforms JPQL query
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Replaces 'select' with 'select distinct'.void
addEntityInGroupBy
(String entityAlias) Adds @param entityAlias to 'group by' clausevoid
addFirstSelectionSource
(String selection) default void
Adds 'join' clausevoid
addJoinAndWhere
(String join, String where) Adds 'join' and 'where' clauses.void
addOrderByIdIfNotExists
(String idProperty) Adds 'order by' clause if it doesn't existsvoid
Adds 'where' clause replacing entity aliasvoid
addWhereAsIs
(String where) Adds 'where' clauseGet parameter names found during transformationGet buffervoid
handleCaseInsensitiveParam
(String paramName) boolean
Replaces 'select distinct' with 'select'.void
Removes 'order by' clausevoid
replaceEntityName
(String newName) Replace main entity name, e.g.void
replaceInCondition
(String paramName) default boolean
replaceIsNullStatements
(String paramName, boolean isNullValue) Replace allis null
andis not null
statements with provided parametervoid
replaceOrderByExpressions
(boolean directionDesc, String... sortExpressions) Deprecated.void
replaceOrderByExpressions
(Map<String, Sort.Direction> sortExpressions) Adds or replaces 'order by' clausevoid
Replacesselect e.f1, e.f2, ...
clause withselect count(e) ...
void
replaceWithSelectEntityVariable
(String selectEntityVariable) Replacesselect e from ...
clause withselect 'selectEntityVariable' from ...
void
replaceWithSelectId
(String pkName) Replacesselect e from ...
clause withselect e.pkName from ...
void
reset()
Reset internal buffer
-
Field Details
-
ALIAS_PLACEHOLDER
Main entity alias placeholder- See Also:
-
-
Method Details
-
addWhere
Adds 'where' clause replacing entity alias -
addWhereAsIs
Adds 'where' clause -
addJoinAndWhere
Adds 'join' and 'where' clauses. Replaces alias in 'join' but doesn't replace it in 'where' -
replaceOrderByExpressions
Deprecated.DEPRECATED. UsereplaceOrderByExpressions(Map)
-
replaceOrderByExpressions
Adds or replaces 'order by' clause -
addFirstSelectionSource
-
replaceWithCount
void replaceWithCount()Replacesselect e.f1, e.f2, ...
clause withselect count(e) ...
-
replaceWithSelectId
Replacesselect e from ...
clause withselect e.pkName from ...
-
replaceWithSelectEntityVariable
Replacesselect e from ...
clause withselect '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
Adds 'order by' clause if it doesn't exists -
addEntityInGroupBy
Adds @param entityAlias to 'group by' clause -
removeOrderBy
void removeOrderBy()Removes 'order by' clause -
replaceEntityName
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
Get parameter names found during transformation -
handleCaseInsensitiveParam
-
replaceInCondition
-
addJoin
Adds 'join' clause -
replaceIsNullStatements
Replace allis null
andis not null
statements with provided parameter- Parameters:
paramName
- name of the parameterisNullValue
- is parameter value null- Returns:
true
if at least one statement was replaced,false
otherwise
-