public interface QueryTransformer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALIAS_PLACEHOLDER
Main entity alias placeholder
|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
void |
addDistinct()
Replaces 'select' with 'select distinct'.
|
void |
addEntityInGroupBy(java.lang.String entityAlias)
Adds @param entityAlias to 'group by' clause
|
void |
addFirstSelectionSource(java.lang.String selection) |
void |
addJoinAndWhere(java.lang.String join,
java.lang.String where)
Adds 'join' and 'where' clauses.
|
void |
addJoinAsIs(java.lang.String join)
Adds 'join' clause
|
void |
addOrderByIdIfNotExists(java.lang.String idProperty)
Adds 'order by' clause if it doesn't exists
|
void |
addWhere(java.lang.String where)
Adds 'where' clause replacing entity alias
|
void |
addWhereAsIs(java.lang.String where)
Adds 'where' clause
|
java.util.Set<java.lang.String> |
getAddedParams()
Get parameter names found during transformation
|
java.lang.String |
getResult()
Get buffer
|
void |
handleCaseInsensitiveParam(java.lang.String paramName) |
void |
mergeWhere(java.lang.String query)
Deprecated.
|
boolean |
removeDistinct()
Replaces 'select distinct' with 'select'.
|
void |
removeOrderBy()
Removes 'order by' clause
|
void |
replaceEntityName(java.lang.String newName)
Replace main entity name, e.g.
|
void |
replaceInCondition(java.lang.String paramName) |
default boolean |
replaceIsNullStatements(java.lang.String paramName,
boolean isNullValue)
Replace all
is null and is not null statements with provided parameter |
void |
replaceOrderBy(boolean desc,
java.lang.String... properties)
Adds or replaces 'order by' clause
|
void |
replaceWithCount()
Replaces
select e.f1, e.f2, ... clause with select count(e) ... |
void |
replaceWithSelectEntityVariable(java.lang.String selectEntityVariable)
Replaces
select e from ... clause with select 'selectEntityVariable' from ... |
void |
replaceWithSelectId()
Replaces
select e from ... clause with select e.id from ... |
void |
replaceWithSelectId(java.lang.String pkName)
Replaces
select e from ... clause with select e.pkName from ... |
void |
reset()
Reset internal buffer
|
static final java.lang.String NAME
static final java.lang.String ALIAS_PLACEHOLDER
void addWhere(java.lang.String where)
void addWhereAsIs(java.lang.String where)
void addJoinAsIs(java.lang.String join)
void addJoinAndWhere(java.lang.String join, java.lang.String where)
void addFirstSelectionSource(java.lang.String selection)
@Deprecated void mergeWhere(java.lang.String query)
void replaceWithCount()
select e.f1, e.f2, ...
clause with select count(e) ...
void replaceWithSelectId()
select e from ...
clause with select e.id from ...
void replaceWithSelectId(java.lang.String pkName)
select e from ...
clause with select e.pkName from ...
void replaceWithSelectEntityVariable(java.lang.String selectEntityVariable)
select e from ...
clause with select 'selectEntityVariable' from ...
boolean removeDistinct()
void addDistinct()
void replaceOrderBy(boolean desc, java.lang.String... properties)
void addOrderByIdIfNotExists(java.lang.String idProperty)
void addEntityInGroupBy(java.lang.String entityAlias)
void removeOrderBy()
void replaceEntityName(java.lang.String newName)
void reset()
java.lang.String getResult()
java.util.Set<java.lang.String> getAddedParams()
void handleCaseInsensitiveParam(java.lang.String paramName)
void replaceInCondition(java.lang.String paramName)
default boolean replaceIsNullStatements(java.lang.String paramName, boolean isNullValue)
is null
and is not null
statements with provided parameterparamName
- name of the parameterisNullValue
- is parameter value nulltrue
if at least one statement was replaced, false
otherwise