Class HqlQueryExecutor
- java.lang.Object
-
- com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor
-
- All Implemented Interfaces:
org.xwiki.component.phase.Initializable
,QueryExecutor
@Component @Named("hql") @Singleton public class HqlQueryExecutor extends Object implements QueryExecutor, org.xwiki.component.phase.Initializable
QueryExecutor implementation for Hibernate Store.- Since:
- 1.6M1
- Version:
- $Id: 6409d9ec7c29ec2314c973073bda0cffdc2d2853 $
-
-
Constructor Summary
Constructors Constructor Description HqlQueryExecutor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
checkAllowed(Query query)
protected String
completeShortFormStatement(String statement)
Append the required select clause to HQL short query statements.protected <T> org.hibernate.query.Query<T>
createHibernateQuery(org.hibernate.Session session, Query query)
Deprecated.since 13.10.6, 14.4, usecreateQuery(Session, Query)
insteadprotected <T> org.hibernate.query.Query<T>
createQuery(org.hibernate.Session session, Query query)
Create an Hibernate query from an XWikiQuery
.<T> List<T>
execute(Query query)
protected Query
filterQuery(Query query)
protected XWikiContext
getContext()
protected XWikiHibernateStore
getStore()
void
initialize()
protected static boolean
isSafeSelect(String statementString)
protected void
populateParameters(org.hibernate.query.Query<?> hquery, Query query)
protected void
setNamedParameter(org.hibernate.query.Query<?> query, String name, Object value)
Sets the value of the specified named parameter, taking into account the type of the given value.
-
-
-
Method Detail
-
initialize
public void initialize() throws org.xwiki.component.phase.InitializationException
- Specified by:
initialize
in interfaceorg.xwiki.component.phase.Initializable
- Throws:
org.xwiki.component.phase.InitializationException
-
isSafeSelect
protected static boolean isSafeSelect(String statementString)
- Parameters:
statementString
- the statement to evaluate- Returns:
- true if the select is allowed for user without PR
-
checkAllowed
protected void checkAllowed(Query query) throws QueryException
- Throws:
QueryException
-
execute
public <T> List<T> execute(Query query) throws QueryException
- Specified by:
execute
in interfaceQueryExecutor
- Throws:
QueryException
-
createQuery
protected <T> org.hibernate.query.Query<T> createQuery(org.hibernate.Session session, Query query)
Create an Hibernate query from an XWikiQuery
.- Type Parameters:
T
- the type to return- Parameters:
session
- the Hibernate sessionquery
- the query to convert- Returns:
- the Hibernate query
-
createHibernateQuery
@Deprecated(since="13.10.6") protected <T> org.hibernate.query.Query<T> createHibernateQuery(org.hibernate.Session session, Query query)
Deprecated.since 13.10.6, 14.4, usecreateQuery(Session, Query)
instead
-
completeShortFormStatement
protected String completeShortFormStatement(String statement)
Append the required select clause to HQL short query statements. Short statements are the only way for users without programming rights to perform queries. Such statements can be for example:, BaseObject obj where doc.fullName=obj.name and obj.className='XWiki.MyClass'
where doc.creationDate > '2008-01-01'
- Parameters:
statement
- the statement to complete if required.- Returns:
- the complete statement if it had to be completed, the original one otherwise.
-
populateParameters
protected void populateParameters(org.hibernate.query.Query<?> hquery, Query query)
- Parameters:
hquery
- query to populate parametersquery
- query from to populate.
-
setNamedParameter
protected void setNamedParameter(org.hibernate.query.Query<?> query, String name, Object value)
Sets the value of the specified named parameter, taking into account the type of the given value.- Parameters:
query
- the query to set the parameter forname
- the parameter namevalue
- the non-null parameter value
-
getStore
protected XWikiHibernateStore getStore()
- Returns:
- Store component
-
getContext
protected XWikiContext getContext()
- Returns:
- XWiki Context
-
-