public interface MagnoliaQueryOperations
MagnoliaTemplate
. Not often used directly,
but a useful option to enhance testability, as it can easily be mocked or stubbed.MagnoliaTemplate
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
queryForList(String repository,
String query,
String language,
String type,
ContentMapper<T> mapper)
Execute a query for a result list of type T, for the given query.
|
<T> T |
queryForObject(String repository,
String query,
String language,
String type,
ContentMapper<T> mapper)
Execute a query for a single or
null result object, for the given query. |
javax.jcr.Node |
xpathQueryForContent(String repository,
String query,
String type)
Execute an XPath query for a Content node.
|
<T> List<T> |
xpathQueryForList(String repository,
String query,
String type,
ContentMapper<T> mapper)
Execute an XPath query for a result list of type T, for the given query.
|
<T> T |
xpathQueryForObject(String repository,
String query,
String type,
ContentMapper<T> mapper)
Execute an XPath query for a single or
null result object, for the given query. |
<T> T queryForObject(String repository, String query, String language, String type, ContentMapper<T> mapper) throws DataAccessException
null
result object, for the given query. This method is useful for
running queries with a known outcome. The query is expected to be a single result query; the returned result will
be directly mapped to the corresponding object type.repository
- the repository to execute query againstquery
- query to executelanguage
- query language (either XPATH
or SQL
).type
- the type of the item to query formapper
- the mapper usednull
in case of a null
queryIncorrectResultSizeDataAccessException
- if the query returns more than one resultsDataAccessException
- if there is any problem executing the query<T> List<T> queryForList(String repository, String query, String language, String type, ContentMapper<T> mapper) throws DataAccessException
repository
- the repository to execute query againstquery
- query to executelanguage
- query language (either XPATH
or SQL
).type
- the type of the item to query formapper
- the mapper usednull
in case of a null
queryDataAccessException
- if there is any problem executing the query<T> T xpathQueryForObject(String repository, String query, String type, ContentMapper<T> mapper) throws DataAccessException
null
result object, for the given query. This method is
useful for running queries with a known outcome. The query is expected to be a single result query; the returned
result will be directly mapped to the corresponding object type.repository
- the repository to execute query againstquery
- query to executetype
- the type of the item to query formapper
- the mapper usednull
in case of a null
queryIncorrectResultSizeDataAccessException
- if the query returns more than one resultsDataAccessException
- if there is any problem executing the query<T> List<T> xpathQueryForList(String repository, String query, String type, ContentMapper<T> mapper) throws DataAccessException
repository
- the repository to execute query againstquery
- query to executetype
- the type of the item to query formapper
- the mapper usednull
in case of a null
Xpath queryDataAccessException
- if there is any problem executing the queryjavax.jcr.Node xpathQueryForContent(String repository, String query, String type) throws DataAccessException
repository
- the repository to execute query againstquery
- query to executetype
- the type of the item to query fornull
if no such node existsDataAccessException
- if there is any problem executing the queryCopyright © 2016 Magnolia International Ltd.. All rights reserved.