Package org.camunda.bpm.engine.impl
Class AbstractQuery<T extends Query<?,?>,U>
- java.lang.Object
-
- org.camunda.bpm.engine.impl.db.ListQueryParameterObject
-
- org.camunda.bpm.engine.impl.AbstractQuery<T,U>
-
- Direct Known Subclasses:
AbstractVariableQueryImpl,ActivityStatisticsQueryImpl,AuthorizationQueryImpl,BatchQueryImpl,BatchStatisticsQueryImpl,CaseDefinitionQueryImpl,CaseSentryPartQueryImpl,CleanableHistoricBatchReportImpl,CleanableHistoricCaseInstanceReportImpl,CleanableHistoricDecisionInstanceReportImpl,CleanableHistoricProcessInstanceReportImpl,DecisionDefinitionQueryImpl,DecisionRequirementsDefinitionQueryImpl,DeploymentQueryImpl,DeploymentStatisticsQueryImpl,EventSubscriptionQueryImpl,ExternalTaskQueryImpl,FilterQueryImpl,GroupQueryImpl,HistoricActivityInstanceQueryImpl,HistoricActivityStatisticsQueryImpl,HistoricBatchQueryImpl,HistoricCaseActivityInstanceQueryImpl,HistoricCaseActivityStatisticsQueryImpl,HistoricDecisionInstanceQueryImpl,HistoricDecisionInstanceStatisticsQueryImpl,HistoricDetailQueryImpl,HistoricExternalTaskLogQueryImpl,HistoricJobLogQueryImpl,HistoricTaskInstanceQueryImpl,HistoricVariableInstanceQueryImpl,IncidentQueryImpl,JobDefinitionQueryImpl,JobQueryImpl,ProcessDefinitionQueryImpl,ProcessDefinitionStatisticsQueryImpl,SchemaLogQueryImpl,TaskQueryImpl,TenantQueryImpl,UserOperationLogQueryImpl,UserQueryImpl
public abstract class AbstractQuery<T extends Query<?,?>,U> extends ListQueryParameterObject implements Command<java.lang.Object>, Query<T,U>, java.io.Serializable
Abstract superclass for all query types.- Author:
- Joram Barrez
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractQuery.ResultType
-
Field Summary
Fields Modifier and Type Field Description protected CommandExecutorcommandExecutorprotected java.util.Map<java.lang.String,java.lang.String>expressionsprotected booleanmaxResultsLimitEnabledprotected AbstractQuery.ResultTyperesultTypestatic java.lang.StringSORTORDER_ASCstatic java.lang.StringSORTORDER_DESCprotected java.util.Set<Validator<AbstractQuery<?,?>>>validators-
Fields inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
authCheck, databaseType, firstResult, maxResults, orderingProperties, parameter, tenantCheck
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractQuery()protectedAbstractQuery(CommandExecutor commandExecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddExpression(java.lang.String key, java.lang.String expression)voidaddValidator(Validator<AbstractQuery<?,?>> validator)Tasc()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 voidcheckMaxResultsLimit()protected voidcheckQueryOk()longcount()Executes the query and returns the number of resultsTdesc()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).Tdirection(Direction direction)voiddisableMaxResultsLimit()voidenableMaxResultsLimit()protected voidevaluateExpressions()longevaluateExpressionsAndExecuteCount(CommandContext commandContext)java.util.List<ImmutablePair<java.lang.String,java.lang.String>>evaluateExpressionsAndExecuteDeploymentIdMappingsList(CommandContext commandContext)java.util.List<java.lang.String>evaluateExpressionsAndExecuteIdsList(CommandContext commandContext)java.util.List<U>evaluateExpressionsAndExecuteList(CommandContext commandContext, Page page)java.lang.Objectexecute(CommandContext commandContext)abstract longexecuteCount(CommandContext commandContext)java.util.List<ImmutablePair<java.lang.String,java.lang.String>>executeDeploymentIdMappingsList(CommandContext commandContext)java.util.List<java.lang.String>executeIdsList(CommandContext commandContext)abstract java.util.List<U>executeList(CommandContext commandContext, Page page)Executes the actual query to retrieve the list of results.java.lang.ObjectexecuteResult(AbstractQuery.ResultType resultType)UexecuteSingleResult(CommandContext commandContext)Textend(T extendingQuery)java.util.Map<java.lang.String,java.lang.String>getExpressions()protected java.lang.reflect.MethodgetMethod(java.lang.String methodName)protected booleanhasExcludingConditions()Whether or not the query has excluding conditions.java.util.List<U>list()Executes the query and get a list of entities as the result.java.util.List<ImmutablePair<java.lang.String,java.lang.String>>listDeploymentIdMappings()java.util.List<java.lang.String>listIds()java.util.List<U>listPage(int firstResult, int maxResults)Executes the query and get a list of entities as the result.protected voidmergeExpressions(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)protected voidmergeOrdering(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)TorderBy(QueryOrderingProperty orderProperty)TorderBy(QueryProperty property)voidremoveValidator(Validator<AbstractQuery<?,?>> validator)AbstractQuery<T,U>setCommandExecutor(CommandExecutor commandExecutor)voidsetExpressions(java.util.Map<java.lang.String,java.lang.String> expressions)UsingleResult()Executes the query and returns the resulting entity or null if no entity matches the query criteria.java.util.List<U>unlimitedList()Executes the query.voidvalidate()voidvalidate(Validator<AbstractQuery<?,?>> validator)-
Methods inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
getAuthCheck, getDatabaseType, getFirstResult, getFirstRow, getLastRow, getMaxResults, getOrderingProperties, getParameter, getTenantCheck, setAuthCheck, setDatabaseType, setFirstResult, setMaxResults, setOrderingProperties, setParameter, setTenantCheck
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.impl.interceptor.Command
isRetryable
-
-
-
-
Field Detail
-
SORTORDER_ASC
public static final java.lang.String SORTORDER_ASC
- See Also:
- Constant Field Values
-
SORTORDER_DESC
public static final java.lang.String SORTORDER_DESC
- See Also:
- Constant Field Values
-
commandExecutor
protected transient CommandExecutor commandExecutor
-
resultType
protected AbstractQuery.ResultType resultType
-
expressions
protected java.util.Map<java.lang.String,java.lang.String> expressions
-
validators
protected java.util.Set<Validator<AbstractQuery<?,?>>> validators
-
maxResultsLimitEnabled
protected boolean maxResultsLimitEnabled
-
-
Constructor Detail
-
AbstractQuery
protected AbstractQuery()
-
AbstractQuery
protected AbstractQuery(CommandExecutor commandExecutor)
-
-
Method Detail
-
setCommandExecutor
public AbstractQuery<T,U> setCommandExecutor(CommandExecutor commandExecutor)
-
orderBy
public T orderBy(QueryProperty property)
-
orderBy
public T orderBy(QueryOrderingProperty orderProperty)
-
asc
public T asc()
Description copied from interface:QueryOrder the results ascending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
-
desc
public T desc()
Description copied from interface:QueryOrder the results descending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
-
checkQueryOk
protected void checkQueryOk()
-
singleResult
public U singleResult()
Description copied from interface:QueryExecutes the query and returns the resulting entity or null if no entity matches the query criteria.- Specified by:
singleResultin interfaceQuery<T extends Query<?,?>,U>
-
list
public java.util.List<U> list()
Description copied from interface:QueryExecutes the query and get a list of entities as the result.
-
listPage
public java.util.List<U> listPage(int firstResult, int maxResults)
Description copied from interface:QueryExecutes the query and get a list of entities as the result.
-
executeResult
public java.lang.Object executeResult(AbstractQuery.ResultType resultType)
-
count
public long count()
Description copied from interface:QueryExecutes the query and returns the number of results
-
unlimitedList
public java.util.List<U> unlimitedList()
Description copied from interface:QueryExecutes the query. No limitation checks are performed (e. g. query limit).- Specified by:
unlimitedListin interfaceQuery<T extends Query<?,?>,U>- Returns:
- a list of results
-
execute
public java.lang.Object execute(CommandContext commandContext)
-
evaluateExpressionsAndExecuteCount
public long evaluateExpressionsAndExecuteCount(CommandContext commandContext)
-
executeCount
public abstract long executeCount(CommandContext commandContext)
-
evaluateExpressionsAndExecuteList
public java.util.List<U> evaluateExpressionsAndExecuteList(CommandContext commandContext, Page page)
-
hasExcludingConditions
protected boolean hasExcludingConditions()
Whether or not the query has excluding conditions. If the query has excluding conditions, (e.g. task due date before and after are excluding), the SQL query is avoided and a default result is returned. The returned result is the same as if the SQL was executed and there were no entries.- Returns:
trueif the query does have excluding conditions,falseotherwise
-
executeList
public abstract java.util.List<U> executeList(CommandContext commandContext, Page page)
Executes the actual query to retrieve the list of results.- Parameters:
page- used if the results must be paged. If null, no paging will be applied.
-
executeSingleResult
public U executeSingleResult(CommandContext commandContext)
-
getExpressions
public java.util.Map<java.lang.String,java.lang.String> getExpressions()
-
setExpressions
public void setExpressions(java.util.Map<java.lang.String,java.lang.String> expressions)
-
addExpression
public void addExpression(java.lang.String key, java.lang.String expression)
-
evaluateExpressions
protected void evaluateExpressions()
-
getMethod
protected java.lang.reflect.Method getMethod(java.lang.String methodName)
-
mergeOrdering
protected void mergeOrdering(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)
-
mergeExpressions
protected void mergeExpressions(AbstractQuery<?,?> extendedQuery, AbstractQuery<?,?> extendingQuery)
-
validate
public void validate()
-
validate
public void validate(Validator<AbstractQuery<?,?>> validator)
-
addValidator
public void addValidator(Validator<AbstractQuery<?,?>> validator)
-
removeValidator
public void removeValidator(Validator<AbstractQuery<?,?>> validator)
-
listIds
public java.util.List<java.lang.String> listIds()
-
listDeploymentIdMappings
public java.util.List<ImmutablePair<java.lang.String,java.lang.String>> listDeploymentIdMappings()
-
evaluateExpressionsAndExecuteIdsList
public java.util.List<java.lang.String> evaluateExpressionsAndExecuteIdsList(CommandContext commandContext)
-
executeIdsList
public java.util.List<java.lang.String> executeIdsList(CommandContext commandContext)
-
evaluateExpressionsAndExecuteDeploymentIdMappingsList
public java.util.List<ImmutablePair<java.lang.String,java.lang.String>> evaluateExpressionsAndExecuteDeploymentIdMappingsList(CommandContext commandContext)
-
executeDeploymentIdMappingsList
public java.util.List<ImmutablePair<java.lang.String,java.lang.String>> executeDeploymentIdMappingsList(CommandContext commandContext)
-
checkMaxResultsLimit
protected void checkMaxResultsLimit()
-
enableMaxResultsLimit
public void enableMaxResultsLimit()
-
disableMaxResultsLimit
public void disableMaxResultsLimit()
-
-