Package io.jmix.data
Interface QueryTransformer
- All Known Implementing Classes:
QueryTransformerAstBased
public interface QueryTransformer
Transforms JPQL query
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidReplaces 'select' with 'select distinct'.voidaddEntityInGroupBy(String entityAlias) Adds @param entityAlias to 'group by' clausevoidaddFirstSelectionSource(String selection) default voidAdds 'join' clausevoidaddJoinAndWhere(String join, String where) Adds 'join' and 'where' clauses.voidaddOrderByIdIfNotExists(String idProperty) Adds 'order by' clause if it doesn't existsvoidAdds 'where' clause replacing entity aliasvoidaddWhereAsIs(String where) Adds 'where' clauseGet parameter names found during transformationGet buffervoidhandleCaseInsensitiveParam(String paramName) booleanReplaces 'select distinct' with 'select'.voidRemoves 'order by' clausevoidreplaceEntityName(String newName) Replace main entity name, e.g.voidreplaceInCondition(String paramName) default booleanreplaceIsNullStatements(String paramName, boolean isNullValue) Replace allis nullandis not nullstatements with provided parametervoidreplaceOrderByExpressions(Map<String, Sort.Direction> sortExpressions) Adds or replaces 'order by' clausevoidReplacesselect e.f1, e.f2, ...clause withselect count(e) ...voidreplaceWithSelectEntityVariable(String selectEntityVariable) Replacesselect e from ...clause withselect 'selectEntityVariable' from ...voidreplaceWithSelectId(String pkName) Replacesselect e from ...clause withselect e.pkName from ...voidreset()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
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 nullandis not nullstatements with provided parameter- Parameters:
paramName- name of the parameterisNullValue- is parameter value null- Returns:
trueif at least one statement was replaced,falseotherwise
-