|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.AbstractQuery net.sf.basedb.core.AbstractHqlQuery net.sf.basedb.core.AbstractEntityQuery
abstract class AbstractEntityQuery
An abstract implementation of the EntityQuery
interface. This class
doesn't support adding selections, groups or having restrictions.
Include
options and permission control are implemented using
Hibernate filters. See QueryRuntimeFilterFactory
.
Field Summary | |
---|---|
private static boolean |
debugEnabled
So we don't always have to call logParam.debug() |
private QueryRuntimeFilterManager |
filterManager
The manager of the runtime query filters. |
private EnumSet<Include> |
includes
Flags specifying which items to include. |
private static Logger |
logParam
Log all parameter bindings to prepared statement. |
private QueryRuntimeFilter |
optionalFilter
Optional runtime filter. |
private Permission |
permission
The logged in user's permission on the items. |
private QueryRuntimeFilter |
requiredFilter
The required runtime filter. |
private Item |
returnType
The item type returned by the query, eg. |
private Item |
rootType
The root item type we start with in the query. eq. |
Constructor Summary | |
---|---|
AbstractEntityQuery(Item returnType,
Item rootType,
String rootName,
String select,
boolean stateless,
QueryRuntimeFilter optionalFilter)
Create a new query that may have different return type and root item type. |
|
AbstractEntityQuery(Item returnType,
String entityName,
boolean stateless)
Create a new query returning items of the specified item type using the default optional runtime filter. |
|
AbstractEntityQuery(Item returnType,
String entityName,
boolean stateless,
QueryRuntimeFilter optionalFilter)
Create a new query returning items of the specified type with a non-default optional runtime filter. |
Method Summary | |
---|---|
long |
count(DbControl dc)
Count the number of items/rows that are returned by the query. |
(package private) void |
disableFilters(DbControl dc)
Disable all enabled runtime query filters for the query. |
(package private) void |
enableFilters(DbControl dc)
Enable runtime query filters for the query. |
void |
exclude(Collection<Include> includes)
|
void |
exclude(Include... excludes)
Specify options for which items to exclude from the result. |
Permission |
getItemPermission()
The logged in user's permission on the items returned by this query. |
Item |
getItemType()
The type of items the query returns. |
QueryType |
getQueryType()
Get the type of query. |
Item |
getRootType()
The type of items that is the root of the query. |
void |
group(Expression expression)
Not supported. |
void |
groupPermanent(Expression expression)
Not supported. |
void |
having(Restriction restriction)
Not supported. |
void |
havingPermanent(Restriction restriction)
Not supported. |
void |
include(Collection<Include> includes)
|
void |
include(Include... includes)
Specify options for which items to include in the result. |
boolean |
isIncluded(Collection<Include> includes)
|
boolean |
isIncluded(Include... includes)
Check which options are set for the items to include in the result |
void |
select(Select select)
Not supported. |
void |
selectPermanent(Select select)
Not supported. |
void |
setAutoJoinType(JoinType joinType)
Specify the join type of automatic joins. |
void |
setIncludes(Collection<Include> includes)
Clears the lists of includes and adds a new collection. |
void |
setItemPermission(Permission permission)
Only return items which the logged in user has the specified permission for. |
Methods inherited from class net.sf.basedb.core.AbstractHqlQuery |
---|
getCountHqlQuery, getMainHqlQuery, getRootAlias, isCachingResult, isReadonly, isStateless, postProcessQuery, reset, setCacheResult, setEntityParameter, setPermanentEntityParameter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.query.HqlQuery |
---|
isCachingResult, setCacheResult, setEntityParameter, setPermanentEntityParameter |
Methods inherited from interface net.sf.basedb.core.query.Query |
---|
addAutoJoiner, getFirstResult, getMaxResults, getParameterNames, getQueryParameter, getQuerySection, getRootAlias, hasParameterValue, isCounting, isDistinct, isReadonly, isReturningTotalCount, join, joinPermanent, order, orderPermanent, reset, restrict, restrictPermanent, setDistinct, setFirstResult, setMaxResults, setParameter, setPermanentParameter, setReturnTotalCount, toQl |
Field Detail |
---|
private static final Logger logParam
private static final boolean debugEnabled
private final Item returnType
private final Item rootType
private final QueryRuntimeFilter requiredFilter
private final QueryRuntimeFilter optionalFilter
private QueryRuntimeFilterManager filterManager
private EnumSet<Include> includes
private Permission permission
Constructor Detail |
---|
AbstractEntityQuery(Item returnType, String entityName, boolean stateless)
returnType
- The type of items that are returnedentityName
- The name of the type of items as known to
Hibernate, or null to use the class of the return typestateless
- TRUE if the stateless Hibernate session should be used, FALSE
if the regular Hibernate session should be usedAbstractEntityQuery(Item returnType, String entityName, boolean stateless, QueryRuntimeFilter optionalFilter)
returnType
- The type of items that are returnedentityName
- The name of the type of items as known to
Hibernate, or null to use the class of the return typestateless
- TRUE if the stateless Hibernate session should be used, FALSE
if the regular Hibernate session should be usedoptionalFilter
- A runtime filter replacing the default optional filter
or null to not use any optional filterAbstractEntityQuery(Item returnType, Item rootType, String rootName, String select, boolean stateless, QueryRuntimeFilter optionalFilter)
DataQuery.DataQuery(Class, Item, String, String)
Method Detail |
---|
public void select(Select select)
select
in interface Query
select
in class AbstractQuery
select
- The query element to add
UnsupportedOperationException
- AlwaysQuery.selectPermanent(Select)
public void selectPermanent(Select select)
selectPermanent
in interface Query
selectPermanent
in class AbstractQuery
select
- The query element to add
UnsupportedOperationException
- AlwaysQuery.select(Select)
public void group(Expression expression)
group
in interface Query
group
in class AbstractQuery
expression
- The query element to add
UnsupportedOperationException
- AlwaysQuery.groupPermanent(Expression)
public void groupPermanent(Expression expression)
groupPermanent
in interface Query
groupPermanent
in class AbstractQuery
expression
- The query element to add
UnsupportedOperationException
- AlwaysQuery.group(Expression)
public void having(Restriction restriction)
having
in interface Query
having
in class AbstractQuery
restriction
- The query element to add
UnsupportedOperationException
- AlwaysQuery.havingPermanent(Restriction)
public void havingPermanent(Restriction restriction)
havingPermanent
in interface Query
havingPermanent
in class AbstractQuery
restriction
- The query element to add
UnsupportedOperationException
- AlwaysQuery.having(Restriction)
public QueryType getQueryType()
Query
getQueryType
in interface Query
getQueryType
in class AbstractHqlQuery
QueryType.HQL
public long count(DbControl dc) throws BaseException
Query
Query.getFirstResult()
and Query.getMaxResults()
settings.
count
in interface Query
count
in class AbstractHqlQuery
BaseException
- If there is an errorpublic Item getItemType()
EntityQuery
getItemType
in interface EntityQuery
public Item getRootType()
EntityQuery
EntityQuery.getItemType()
, but not
always.
getRootType
in interface EntityQuery
public void include(Include... includes)
EntityQuery
include
in interface EntityQuery
includes
- An array of items that should be includedEntityQuery.exclude(Include[])
public void include(Collection<Include> includes)
include
in interface EntityQuery
EntityQuery.include(Include[])
public void setIncludes(Collection<Include> includes)
EntityQuery
setIncludes
in interface EntityQuery
includes
- The new includes to be hold in the list.EntityQuery.include(Include...)
public void exclude(Include... excludes)
EntityQuery
exclude
in interface EntityQuery
excludes
- An array of options that should be excludedEntityQuery.include(Include[])
public void exclude(Collection<Include> includes)
exclude
in interface EntityQuery
EntityQuery.exclude(Include[])
public boolean isIncluded(Include... includes)
EntityQuery
isIncluded
in interface EntityQuery
includes
- The options to check
public boolean isIncluded(Collection<Include> includes)
isIncluded
in interface EntityQuery
EntityQuery.isIncluded(Include[])
public void setItemPermission(Permission permission)
EntityQuery
setItemPermission
in interface EntityQuery
permission
- The required permissionpublic Permission getItemPermission()
EntityQuery
getItemPermission
in interface EntityQuery
public void setAutoJoinType(JoinType joinType)
JoinType.LEFT
. This setting doesn't affect joins that has been made
directly to the query.
joinType
- The type of the automatic joinsvoid enableFilters(DbControl dc)
disableFilters(DbControl)
void disableFilters(DbControl dc)
enableFilters(DbControl)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |