org.camunda.bpm.engine.impl
Class AbstractQuery<T extends Query<?,?>,U>

java.lang.Object
  extended by org.camunda.bpm.engine.impl.db.AuthorizationCheck
      extended by org.camunda.bpm.engine.impl.db.ListQueryParameterObject
          extended by org.camunda.bpm.engine.impl.AbstractQuery<T,U>
All Implemented Interfaces:
Serializable, Command<Object>, Query<T,U>
Direct Known Subclasses:
AbstractVariableQueryImpl, ActivityStatisticsQueryImpl, AuthorizationQueryImpl, CaseDefinitionQueryImpl, CaseSentryPartQueryImpl, DeploymentQueryImpl, DeploymentStatisticsQueryImpl, EventSubscriptionQueryImpl, FilterQueryImpl, GroupQueryImpl, HistoricActivityInstanceQueryImpl, HistoricActivityStatisticsQueryImpl, HistoricCaseActivityInstanceQueryImpl, HistoricDetailQueryImpl, HistoricTaskInstanceQueryImpl, HistoricVariableInstanceQueryImpl, IncidentQueryImpl, JobDefinitionQueryImpl, JobQueryImpl, ProcessDefinitionQueryImpl, ProcessDefinitionStatisticsQueryImpl, TaskQueryImpl, UserOperationLogQueryImpl, UserQueryImpl

public abstract class AbstractQuery<T extends Query<?,?>,U>
extends ListQueryParameterObject
implements Command<Object>, Query<T,U>, Serializable

Abstract superclass for all query types.

Author:
Joram Barrez
See Also:
Serialized Form

Field Summary
protected  CommandContext commandContext
           
protected  CommandExecutor commandExecutor
           
protected  Map<String,String> expressions
           
protected  QueryProperty orderProperty
           
protected  org.camunda.bpm.engine.impl.AbstractQuery.ResultType resultType
           
static String SORTORDER_ASC
           
static String SORTORDER_DESC
           
 
Fields inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
databaseType, DEFAULT_ORDER_BY, firstResult, maxResults, orderBy, parameter
 
Fields inherited from class org.camunda.bpm.engine.impl.db.AuthorizationCheck
authDefaultPerm, authGroupIds, authPerms, authResourceId, authResourceIdQueryParam, authResourceType, authUserId, isAuthorizationCheckEnabled
 
Constructor Summary
protected AbstractQuery()
           
  AbstractQuery(CommandContext commandContext)
           
protected AbstractQuery(CommandExecutor commandExecutor)
           
 
Method Summary
 void addExpression(String key, String expression)
           
protected  void addOrder(String column, String sortOrder)
           
 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 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)
           
protected  void evaluateExpressions()
           
 long evaluateExpressionsAndExecuteCount(CommandContext commandContext)
           
 List<U> evaluateExpressionsAndExecuteList(CommandContext commandContext, Page page)
           
 Object execute(CommandContext commandContext)
           
abstract  long executeCount(CommandContext commandContext)
           
abstract  List<U> executeList(CommandContext commandContext, Page page)
          Executes the actual query to retrieve the list of results.
 U executeSingleResult(CommandContext commandContext)
           
 T extend(T extendingQuery)
           
 Map<String,String> getExpressions()
           
protected  Method getMethod(String methodName)
           
 String getOrderBy()
           
 QueryProperty getOrderProperty()
           
 List<U> list()
          Executes the query and get a list of entities as the result.
 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(QueryProperty property)
           
 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.
 
Methods inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
getDatabaseType, getFirstResult, getFirstRow, getLastRow, getMaxResults, getParameter, setDatabaseType, setFirstResult, setMaxResults, setOrderBy, setParameter
 
Methods inherited from class org.camunda.bpm.engine.impl.db.AuthorizationCheck
getAuthDefaultPerm, getAuthGroupIds, getAuthPerms, getAuthResourceId, getAuthResourceIdQueryParam, getAuthResourceType, getAuthUserId, isAuthorizationCheckEnabled, setAuthDefaultPerm, setAuthGroupIds, setAuthorizationCheckEnabled, setAuthPerms, setAuthResourceId, setAuthResourceIdQueryParam, setAuthResourceType, setAuthUserId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SORTORDER_ASC

public static final String SORTORDER_ASC
See Also:
Constant Field Values

SORTORDER_DESC

public static final String SORTORDER_DESC
See Also:
Constant Field Values

commandExecutor

protected transient CommandExecutor commandExecutor

commandContext

protected transient CommandContext commandContext

resultType

protected org.camunda.bpm.engine.impl.AbstractQuery.ResultType resultType

orderProperty

protected QueryProperty orderProperty

expressions

protected Map<String,String> expressions
Constructor Detail

AbstractQuery

protected AbstractQuery()

AbstractQuery

protected AbstractQuery(CommandExecutor commandExecutor)

AbstractQuery

public AbstractQuery(CommandContext commandContext)
Method Detail

setCommandExecutor

public AbstractQuery<T,U> setCommandExecutor(CommandExecutor commandExecutor)

orderBy

public T orderBy(QueryProperty property)

asc

public T asc()
Description copied from interface: Query
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).

Specified by:
asc in interface Query<T extends Query<?,?>,U>

desc

public T desc()
Description copied from interface: Query
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).

Specified by:
desc in interface Query<T extends Query<?,?>,U>

direction

public T direction(Direction direction)

checkQueryOk

protected void checkQueryOk()

singleResult

public U singleResult()
Description copied from interface: Query
Executes the query and returns the resulting entity or null if no entity matches the query criteria.

Specified by:
singleResult in interface Query<T extends Query<?,?>,U>

list

public List<U> list()
Description copied from interface: Query
Executes the query and get a list of entities as the result.

Specified by:
list in interface Query<T extends Query<?,?>,U>

listPage

public List<U> listPage(int firstResult,
                        int maxResults)
Description copied from interface: Query
Executes the query and get a list of entities as the result.

Specified by:
listPage in interface Query<T extends Query<?,?>,U>

count

public long count()
Description copied from interface: Query
Executes the query and returns the number of results

Specified by:
count in interface Query<T extends Query<?,?>,U>

execute

public Object execute(CommandContext commandContext)
Specified by:
execute in interface Command<Object>

evaluateExpressionsAndExecuteCount

public long evaluateExpressionsAndExecuteCount(CommandContext commandContext)

executeCount

public abstract long executeCount(CommandContext commandContext)

evaluateExpressionsAndExecuteList

public List<U> evaluateExpressionsAndExecuteList(CommandContext commandContext,
                                                 Page page)

executeList

public abstract 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)

addOrder

protected void addOrder(String column,
                        String sortOrder)

getOrderBy

public String getOrderBy()
Overrides:
getOrderBy in class ListQueryParameterObject

getOrderProperty

public QueryProperty getOrderProperty()

getExpressions

public Map<String,String> getExpressions()

setExpressions

public void setExpressions(Map<String,String> expressions)

addExpression

public void addExpression(String key,
                          String expression)

evaluateExpressions

protected void evaluateExpressions()

getMethod

protected Method getMethod(String methodName)

extend

public T extend(T extendingQuery)

mergeOrdering

protected void mergeOrdering(AbstractQuery<?,?> extendedQuery,
                             AbstractQuery<?,?> extendingQuery)

mergeExpressions

protected void mergeExpressions(AbstractQuery<?,?> extendedQuery,
                                AbstractQuery<?,?> extendingQuery)


Copyright © 2014 camunda services GmbH. All rights reserved.