コード例 #1
0
 @Override
 public void rejectComment(CoreSession session, DocumentModel doc, String commentId) {
   TaskService taskService = Framework.getService(TaskService.class);
   Task moderationTask = getModerationTask(taskService, session, doc, commentId);
   if (moderationTask == null) {
     session.followTransition(new IdRef(commentId), CommentsConstants.REJECT_STATE);
   } else {
     taskService.rejectTask(
         session, (NuxeoPrincipal) session.getPrincipal(), moderationTask, null);
   }
 }
コード例 #2
0
  @Override
  public void approveComent(CoreSession session, DocumentModel doc, String commentId) {
    TaskService taskService = Framework.getService(TaskService.class);
    Task moderationTask = getModerationTask(taskService, session, doc, commentId);
    if (moderationTask == null) {
      session.followTransition(
          new IdRef(commentId), CommentsConstants.TRANSITION_TO_PUBLISHED_STATE);
    } else {
      taskService.acceptTask(
          session, (NuxeoPrincipal) session.getPrincipal(), moderationTask, null);
    }

    Map<String, Serializable> eventInfo = new HashMap<String, Serializable>();
    eventInfo.put("emailDetails", "test");
    notifyEvent(session, CommentsConstants.COMMENT_PUBLISHED, null, null, null, doc);
  }
コード例 #3
0
ファイル: TestTreeIndexing.java プロジェクト: mindis/nuxeo
  @Test
  public void shouldReindexSubTreeInTrash() throws Exception {
    buildAndIndexTree();
    startTransaction();
    DocumentRef ref = new PathRef("/folder0/folder1/folder2");
    Assert.assertTrue(session.exists(ref));
    session.followTransition(ref, "delete");

    TransactionHelper.commitOrRollbackTransaction();
    // let the bulkLifeCycleChangeListener do its work
    waitForCompletion();
    assertNumberOfCommandProcessed(8);

    startTransaction();
    DocumentModelList docs =
        ess.query(
            new NxQueryBuilder(session)
                .nxql("select * from Document where ecm:currentLifeCycleState != 'deleted'"));
    // for (DocumentModel doc : docs) {
    // System.out.println(doc.getPathAsString());
    // }
    Assert.assertEquals(2, docs.totalSize());
  }
コード例 #4
0
  @Override
  public void publishComment(CoreSession session, DocumentModel comment) {
    session.followTransition(comment.getRef(), CommentsConstants.TRANSITION_TO_PUBLISHED_STATE);

    notifyEvent(session, CommentsConstants.COMMENT_PUBLISHED, null, null, null, comment);
  }