@OperationMethod
  public DocumentModelList run() throws OperationException {

    String workingListName = listName;
    if (StringUtils.isEmpty(workingListName)) {
      workingListName = DocumentsListsManager.CURRENT_DOCUMENT_SELECTION;
    }

    List<DocumentModel> res = null;
    if (OperationHelper.isSeamContextAvailable()) {
      res = OperationHelper.getDocumentListManager().getWorkingList(workingListName);
    } else {
      if (OperationHelper.getDocumentListManager()
          .getWorkingListDescriptor(workingListName)
          .getPersistent()) {
        DocumentsListsPersistenceManager pm = new DocumentsListsPersistenceManager();
        res =
            pm.loadPersistentDocumentsLists(
                ctx.getCoreSession(), ctx.getPrincipal().getName(), workingListName);
      } else {
        throw new OperationException(
            String.format(
                "Cannot get selected documents from selection list '%s' because the Seam context is not available and this list is not persisted.",
                workingListName));
      }
    }
    return new DocumentModelListImpl(res);
  }
예제 #2
0
 @OperationMethod
 public DocumentModel run(DocumentModel doc) {
   if (OperationHelper.isSeamContextAvailable()) {
     OperationHelper.getDocumentListManager().addToWorkingList(DEFAULT_WORKING_LIST, doc);
   } else {
     DocumentsListsPersistenceManager pm = new DocumentsListsPersistenceManager();
     pm.addDocumentToPersistentList(ctx.getPrincipal().getName(), DEFAULT_WORKING_LIST, doc);
   }
   return doc;
 }