|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueryService
The QueryService
provides the ability to retrieve WCM Document
by Query
.
Here is an example of how to retrieve and use the QueryService
to find the first content directly under the SiteArea parentSiteArea
that has an element called "myElement":
Content contentWithMyElement; QueryService queryService = workspace.getQueryService(); Query query = queryService.createQuery(Content.class); query.addParentId(parentSiteArea.getId(), QueryDepth.CHILDREN); try { ResultIterator resultIterator = queryService.execute(query); if (resultIterator.hasNext()) { Content childContent = (Content) resultIterator.next(); if (childContent.hasComponent("myElement")) { contentWithMyElement = childContent; } } } catch (QueryServiceException e) { // Handle exception }
Nested Class Summary | |
---|---|
static class |
QueryService.FilterOperation
The logical operation used to filter when filtering with multiple users. |
Method Summary | |
---|---|
long |
count(Query query)
Deprecated. The count returned is not accurate due to limitations within PAC. |
long |
count(Query query,
QueryScope p_scope)
Deprecated. The count returned is not accurate due to limitations within PAC. |
AccessFilter |
createAccessFilter(Access access,
QueryService.FilterOperation operation,
java.lang.String... members)
Create an access filter. |
QueryScope |
createProjectScope(Identity<Project> p_project)
Create a query scope, that scopes to a project. |
Query |
createQuery()
Create a empty query. |
Query |
createQuery(java.lang.Class<? extends Item> apiType)
Create a query for a given WCM API type. |
Query |
createQuery(java.lang.Class<? extends Item> apiType,
Query parentQuery,
QueryDepth depth)
Create a query for a given type and parent. |
ResultIterator |
execute(Query query)
Execute a Query . |
PageIterator |
execute(Query query,
int resultsPerPage,
int firstPage)
Execute a Query with paging parameter. |
ResultIterator |
execute(Query p_query,
QueryScope p_scope)
Execute a Query using the given QueryScope . |
PageIterator |
execute(Query query,
QueryScope p_scope,
int resultsPerPage,
int firstPage)
Execute a Query using paging parameter, within the given QueryScope . |
Method Detail |
---|
Query createQuery()
Query
Query createQuery(java.lang.Class<? extends Item> apiType)
DocumentType
, use DocumentType#getAPIType()
apiType
- the WCM API type of item to find
Query
for the given typeQuery createQuery(java.lang.Class<? extends Item> apiType, Query parentQuery, QueryDepth depth)
Note 1: To get the API type from a DocumentType
, use DocumentType#getAPIType()
Note 2: Children will only be returned from PUBLISHED
parents. If your parentQuery needs to be Project-Aware,
then first execute it under a Project QueryScope
then set the returned Parent Ids on the Query via the
Query.setParentIds
/ Query.addParentId
methods
apiType
- the WCM API type of item to findparentQuery
- a query for the parent itemsdepth
- return all descendants or just children
Query
QueryScope createProjectScope(Identity<Project> p_project)
p_project
- the identity of the project to scope to
AccessFilter createAccessFilter(Access access, QueryService.FilterOperation operation, java.lang.String... members)
AccessFilter
object can be applied to
a query. The results of the query will only contain items where all of members
have the specified access
access
- the access to filter withoperation
- the logical operation to perform when multiple users are specifiedmembers
- the members used to filter
Query.setAccessFilter(AccessFilter)
ResultIterator execute(Query query) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
Query
.
query
- the query will be executed
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
ResultIterator execute(Query p_query, QueryScope p_scope) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
Query
using the given QueryScope
.
If the QueryScope
in null
the query will be
executed with no scope.
p_query
- the query will be executedp_scope
- the scope the query is executed in
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
PageIterator execute(Query query, int resultsPerPage, int firstPage) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException, java.lang.IllegalArgumentException
Query
with paging parameter.
query
- the query will be executedresultsPerPage
- how many results per pagefirstPage
- the first page of the return result
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
java.lang.IllegalArgumentException
PageIterator execute(Query query, QueryScope p_scope, int resultsPerPage, int firstPage) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException, java.lang.IllegalArgumentException
Query
using paging parameter, within the given QueryScope
.
If the QueryScope
in null
the query will be
executed with no scope.
query
- the query will be executedp_scope
- the query scoperesultsPerPage
- how many results per pagefirstPage
- the first page of the return result
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
java.lang.IllegalArgumentException
long count(Query query) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
query
- the query will be executed
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
long count(Query query, QueryScope p_scope) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
QueryScope
.
If the QueryScope
in null
the query will be
executed with no scope.
query
- the query will be executedp_scope
- the query scope
com.ibm.workplace.wcm.api.exceptions.QueryServiceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |