コード例 #1
0
  public List<Comment> getAllCommentsByResourceUri(String uri) {
    Resource resource = resourceFacade.findByUri(uri);

    if (resource == null) return null;

    return resource.getCommentList();
  }
コード例 #2
0
  /**
   * Adds comment for a resource. If the resource is not available it will be created.
   *
   * @param comment - comment
   */
  public void addComment(String uri, Comment comment) {

    Resource resource = resourceFacade.findByUri(uri);

    if (resource == null) {
      resource = resourceFacade.createByUri(uri);
    }

    comment.setResource(resource);
    resource.getCommentList().add(comment);
  }