PREV CLASS NEXT CLASS
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.workplace.wcm.api.query
Interface QueryService
public interface QueryServiceThe 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 }
- Since:
- 7.0
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 createQuery
Query createQuery()
- Create a empty query.
- Returns:
- An empty Query
createQuery
Query createQuery(java.lang.Class<? extends Item> apiType)
- Create a query for a given WCM API type. Note: To get the API type from a DocumentType, use DocumentType#getAPIType()
- Parameters:
- apiType - the WCM API type of item to find
- Returns:
- Query for the given type
createQuery
Query createQuery(java.lang.Class<? extends Item> apiType, Query parentQuery, QueryDepth depth)
- Create a query for a given type and parent.
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
- Parameters:
- apiType - the WCM API type of item to find
- parentQuery - a query for the parent items
- depth - return all descendants or just children
- Returns:
- Query
createProjectScope
QueryScope createProjectScope(Identity<Project> p_project)
- Create a query scope, that scopes to a project.
- Parameters:
- p_project - the identity of the project to scope to
- Returns:
- the query scope
createAccessFilter
AccessFilter createAccessFilter(Access access, QueryService.FilterOperation operation, java.lang.String... members)
- Create an access filter. An 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
- Parameters:
- access - the access to filter with
- operation - the logical operation to perform when multiple users are specified
- members - the members used to filter
- Returns:
- the access filter.
- See Also:
- Query.setAccessFilter(AccessFilter)
execute
ResultIterator execute(Query query) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
- Execute a Query.
- Parameters:
- query - the query will be executed
- Returns:
- query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
execute
ResultIterator execute(Query p_query, QueryScope p_scope) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
- Execute a Query using the given QueryScope. If the QueryScope in null the query will be executed with no scope.
- Parameters:
- p_query - the query will be executed
- p_scope - the scope the query is executed in
- Returns:
- query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
execute
PageIterator execute(Query query, int resultsPerPage, int firstPage) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException, java.lang.IllegalArgumentException
- Execute a Query with paging parameter.
- Parameters:
- query - the query will be executed
- resultsPerPage - how many results per page
- firstPage - the first page of the return result
- Returns:
- query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
- java.lang.IllegalArgumentException
execute
PageIterator execute(Query query, QueryScope p_scope, int resultsPerPage, int firstPage) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException, java.lang.IllegalArgumentException
- Execute a Query using paging parameter, within the given QueryScope. If the QueryScope in null the query will be executed with no scope.
- Parameters:
- query - the query will be executed
- p_scope - the query scope
- resultsPerPage - how many results per page
- firstPage - the first page of the return result
- Returns:
- query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
- java.lang.IllegalArgumentException
count
long count(Query query) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceException
- Deprecated. The count returned is not accurate due to limitations within PAC.
- Count the query result without retrieving the actual data.
- Parameters:
- query - the query will be executed
- Returns:
- count for the query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
count
long count(Query query, QueryScope p_scope) throws com.ibm.workplace.wcm.api.exceptions.QueryServiceExceptionPREV CLASS NEXT CLASS
- Deprecated. The count returned is not accurate due to limitations within PAC.
- Count the query result without retrieving the actual data, within the give QueryScope. If the QueryScope in null the query will be executed with no scope.
- Parameters:
- query - the query will be executed
- p_scope - the query scope
- Returns:
- count for the query result
- Throws:
- com.ibm.workplace.wcm.api.exceptions.QueryServiceException
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD