Package org.olat.core.commons.services.commentAndRating.model

Examples of org.olat.core.commons.services.commentAndRating.model.UserComment


   * @see org.olat.core.commons.services.commentAndRating.UserCommentsManager#createComment(org.olat.core.id.Identity,
   *      java.lang.String)
   */
  @Override
  public UserComment createComment(Identity creator, String commentText) {
    UserComment comment = new UserCommentImpl(getOLATResourceable(),
        getOLATResourceableSubPath(), creator, commentText);
    DBFactory.getInstance().saveObject(comment);
    return comment;
  }
View Full Code Here


    } else if (source == replyCommentFormCtr) {
      // User Saved or canceled form
      replyCmc.deactivate();
      if (event == Event.CHANGED_EVENT) {
        // Update view
        UserComment newReply = replyCommentFormCtr.getComment();
        allComments.add(newReply);
        // Create child controller
        UserCommentDisplayController replyCtr = new UserCommentDisplayController(ureq, getWindowControl(), commentManager, newReply, allComments, securityCallback);
        replyControllers.add(replyCtr);
        listenTo(replyCtr);
View Full Code Here

    if (source == createCommentFormCtr) {
      if (event == Event.CANCELLED_EVENT) {
        // do nothing
      } else if (event == Event.CHANGED_EVENT) {
        // Add new comment to view instead of rebuilding datamodel to reduce overhead
        UserComment newComment = createCommentFormCtr.getComment();
        allComments.add(newComment);
        this.commentsCount = this.commentManager.countComments();
        if (allComments.size() != commentsCount.longValue()) {
          // Ups, we have also other changes in the datamodel, reload everything
          buildTopLevelComments(ureq, true);
View Full Code Here

    // add comments
    UserCommentsManager ucm = service.getUserCommentsManager();
    UserCommentsManager ucm2 = serviceWithSubPath.getUserCommentsManager();
   
    UserComment comment1 = ucm.createComment(ident1, "Hello World");
    UserComment comment2 = ucm2.createComment(ident1, "Hello World with subpath");
    // count must be 1 now. count without subpath should not include the results with subpath
    assertEquals(Long.valueOf(1), service.getUserCommentsManager().countComments());
    assertEquals(Long.valueOf(1), serviceWithSubPath.getUserCommentsManager().countComments());
    //
    UserComment comment3 = ucm.createComment(ident2, "Hello World");
    UserComment comment4 = ucm2.createComment(ident2, "Hello World with subpath");
    assertEquals(Long.valueOf(2), service.getUserCommentsManager().countComments());
    assertEquals(Long.valueOf(2), serviceWithSubPath.getUserCommentsManager().countComments());
    // Same with get method
    List<UserComment> commentList = ucm.getComments();
    assertEquals(2, commentList.size());
View Full Code Here

TOP

Related Classes of org.olat.core.commons.services.commentAndRating.model.UserComment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.