public abstract class AbstractQuery<T extends Query<?,?>,U> extends ListQueryParameterObject implements Command<Object>, Query<T,U>, Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractQuery.ResultType |
Modifier and Type | Field and Description |
---|---|
protected CommandExecutor |
commandExecutor |
protected Map<String,String> |
expressions |
protected boolean |
maxResultsLimitEnabled |
protected AbstractQuery.ResultType |
resultType |
static String |
SORTORDER_ASC |
static String |
SORTORDER_DESC |
protected Set<Validator<AbstractQuery<?,?>>> |
validators |
authCheck, databaseType, firstResult, maxResults, orderingProperties, parameter, tenantCheck
Modifier | Constructor and Description |
---|---|
protected |
AbstractQuery() |
protected |
AbstractQuery(CommandExecutor commandExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
addExpression(String key,
String expression) |
void |
addValidator(Validator<AbstractQuery<?,?>> validator) |
T |
asc()
Order the results ascending on the given property as defined in this
class (needs to come after a call to one of the orderByXxxx methods).
|
protected void |
checkMaxResultsLimit() |
protected void |
checkQueryOk() |
long |
count()
Executes the query and returns the number of results
|
T |
desc()
Order the results descending on the given property as defined in this
class (needs to come after a call to one of the orderByXxxx methods).
|
T |
direction(Direction direction) |
void |
disableMaxResultsLimit() |
void |
enableMaxResultsLimit() |
protected void |
evaluateExpressions() |
long |
evaluateExpressionsAndExecuteCount(CommandContext commandContext) |
List<String> |
evaluateExpressionsAndExecuteIdsList(CommandContext commandContext) |
List<U> |
evaluateExpressionsAndExecuteList(CommandContext commandContext,
Page page) |
Object |
execute(CommandContext commandContext) |
abstract long |
executeCount(CommandContext commandContext) |
List<String> |
executeIdsList(CommandContext commandContext) |
abstract List<U> |
executeList(CommandContext commandContext,
Page page)
Executes the actual query to retrieve the list of results.
|
Object |
executeResult(AbstractQuery.ResultType resultType) |
U |
executeSingleResult(CommandContext commandContext) |
T |
extend(T extendingQuery) |
Map<String,String> |
getExpressions() |
protected Method |
getMethod(String methodName) |
protected boolean |
hasExcludingConditions()
Whether or not the query has excluding conditions.
|
List<U> |
list()
Executes the query and get a list of entities as the result.
|
List<String> |
listIds() |
List<U> |
listPage(int firstResult,
int maxResults)
Executes the query and get a list of entities as the result.
|
protected void |
mergeExpressions(AbstractQuery<?,?> extendedQuery,
AbstractQuery<?,?> extendingQuery) |
protected void |
mergeOrdering(AbstractQuery<?,?> extendedQuery,
AbstractQuery<?,?> extendingQuery) |
T |
orderBy(QueryOrderingProperty orderProperty) |
T |
orderBy(QueryProperty property) |
void |
removeValidator(Validator<AbstractQuery<?,?>> validator) |
AbstractQuery<T,U> |
setCommandExecutor(CommandExecutor commandExecutor) |
void |
setExpressions(Map<String,String> expressions) |
U |
singleResult()
Executes the query and returns the resulting entity or null if no
entity matches the query criteria.
|
List<U> |
unboundedResultList() |
void |
validate() |
void |
validate(Validator<AbstractQuery<?,?>> validator) |
getAuthCheck, getDatabaseType, getFirstResult, getFirstRow, getLastRow, getMaxResults, getOrderingProperties, getParameter, getTenantCheck, setAuthCheck, setDatabaseType, setFirstResult, setMaxResults, setOrderingProperties, setParameter, setTenantCheck
public static final String SORTORDER_ASC
public static final String SORTORDER_DESC
protected transient CommandExecutor commandExecutor
protected AbstractQuery.ResultType resultType
protected Set<Validator<AbstractQuery<?,?>>> validators
protected boolean maxResultsLimitEnabled
protected AbstractQuery()
protected AbstractQuery(CommandExecutor commandExecutor)
public AbstractQuery<T,U> setCommandExecutor(CommandExecutor commandExecutor)
public T orderBy(QueryProperty property)
public T orderBy(QueryOrderingProperty orderProperty)
public T asc()
Query
public T desc()
Query
protected void checkQueryOk()
public U singleResult()
Query
singleResult
in interface Query<T extends Query<?,?>,U>
public List<U> list()
Query
public List<U> listPage(int firstResult, int maxResults)
Query
public Object executeResult(AbstractQuery.ResultType resultType)
public long count()
Query
public Object execute(CommandContext commandContext)
public long evaluateExpressionsAndExecuteCount(CommandContext commandContext)
public abstract long executeCount(CommandContext commandContext)
public List<U> evaluateExpressionsAndExecuteList(CommandContext commandContext, Page page)
protected boolean hasExcludingConditions()
true
if the query does have excluding conditions, false
otherwisepublic abstract List<U> executeList(CommandContext commandContext, Page page)
page
- used if the results must be paged. If null, no paging will be applied.public U executeSingleResult(CommandContext commandContext)
protected void evaluateExpressions()
protected void mergeOrdering(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)
protected void mergeExpressions(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)
public void validate()
public void validate(Validator<AbstractQuery<?,?>> validator)
public void addValidator(Validator<AbstractQuery<?,?>> validator)
public void removeValidator(Validator<AbstractQuery<?,?>> validator)
public List<String> evaluateExpressionsAndExecuteIdsList(CommandContext commandContext)
public List<String> executeIdsList(CommandContext commandContext)
protected void checkMaxResultsLimit()
public void enableMaxResultsLimit()
public void disableMaxResultsLimit()
Copyright © 2019. All rights reserved.