content-management-systemwcm

How to query "pending my approval" items in IBM WCM 7.0


I'm working in a project which reques me to display a list of "pending my approval" my items to content manager of my client. I've checked the new Query API inside WCM 7. I'm thinking I need following code to query the content libraries:

    QueryService queryService = workspace.getQueryService();
    Query query= queryService.createQuery(Content.class);
    query.addSelector(Selectors.libraryEquals(library));
    // Following selector is faked
    query.addSelector(Selectors.waitingMyApproval());

The last line in above script is a faked one, which doesn't exist in WCM API. com.ibm.wcm.workplace.wcm.api.WorkSpace has an "hasManagerAccess(DocumentId) boolean" method, but it can only check one document.

Is there a way to query the whole library and get all items pending on approval of current user?

Thanks a lot!


Solution

  • Got answer from IBM forum (provided by David De Vos) and document it here:

    Try using the WorkflowSelectors.approversContains() selector which expects you to supply one or more strings representing the distinguished names of the approvers to look for.