public void processSelectRow(
     String docRef, String contentViewName, String listName, Boolean selection)
     throws ClientException {
   List<DocumentModel> documents = getCurrentPageDocuments(contentViewName);
   DocumentModel doc = null;
   if (documents != null) {
     for (DocumentModel pagedDoc : documents) {
       if (pagedDoc.getRef().toString().equals(docRef)) {
         doc = pagedDoc;
         break;
       }
     }
   }
   if (doc == null) {
     log.error(
         String.format(
             "could not find doc '%s' in the current page of " + "content view page provider '%s'",
             docRef, contentViewName));
     return;
   }
   String lName = (listName == null) ? DocumentsListsManager.CURRENT_DOCUMENT_SELECTION : listName;
   if (Boolean.TRUE.equals(selection)) {
     documentsListsManager.addToWorkingList(lName, doc);
   } else {
     documentsListsManager.removeFromWorkingList(lName, doc);
   }
 }
  /**
   * Processes the version selection row.
   *
   * @param versionModelSelection the version model selection
   * @throws ClientException the client exception
   */
  protected final void processVersionSelectRow(PageSelection<VersionModel> versionModelSelection)
      throws ClientException {

    DocumentModel currentDocument = navigationContext.getCurrentDocument();
    if (currentDocument == null) {
      throw new ClientException(
          "Cannot process version select row since current document is null.");
    }

    DocumentModel version =
        documentManager.getDocumentWithVersion(
            currentDocument.getRef(), versionModelSelection.getData());
    if (version == null) {
      throw new ClientException(
          "Cannot process version select row since selected version document is null.");
    }

    if (Boolean.TRUE.equals(versionModelSelection.isSelected())) {
      documentsListsManager.addToWorkingList(
          DocumentsListsManager.CURRENT_VERSION_SELECTION, version);
    } else {
      documentsListsManager.removeFromWorkingList(
          DocumentsListsManager.CURRENT_VERSION_SELECTION, version);
    }
  }
 public void processSelectPage(String contentViewName, String listName, Boolean selection)
     throws ClientException {
   List<DocumentModel> documents = getCurrentPageDocuments(contentViewName);
   if (documents != null) {
     String lName =
         (listName == null) ? DocumentsListsManager.CURRENT_DOCUMENT_SELECTION : listName;
     if (Boolean.TRUE.equals(selection)) {
       documentsListsManager.addToWorkingList(lName, documents);
     } else {
       documentsListsManager.removeFromWorkingList(lName, documents);
     }
   }
 }