Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface CommentManager

All Superinterfaces:
JiveManager

public interface CommentManager
extends JiveManager

Handles comments for a JiveObject. Comments can be nested in a tree structure to allow for the promotions of discussions on an object. There are two options for navigating through the comments to an object:


Field Summary
static int COMMENTS_CLOSED
          Comment status for documents that may have allowed comments in the past but presently do not accept comments.
static int COMMENTS_DEFAULT
          The default comment status for a document.
static int COMMENTS_NONE
          Comment status for documents that do not accept comments.
static int COMMENTS_OPEN
          Comment status for documents that do accept comments.
 
Method Summary
 void addComment(JiveObject contentObject, Comment newComment)
          Adds a new comment (no parent) to the object.
 void addComment(JiveObject contentObject, Comment parentComment, Comment newComment)
          Adds a new comment having a parent comment to the object.
 Comment createComment(JiveObject contentObject, User user, java.lang.String body)
          Create a new comment.
 void deleteAllComments(JiveObject contentObject)
          Deletes all comments on the object.
 void deleteComment(JiveObject contentObject, Comment comment)
          Deletes a comment in the object.
 void deleteComment(JiveObject contentObject, Comment comment, boolean recursive)
          Deletes a comment in the object.
 Comment getComment(JiveObject contentObject, long commentID)
          Returns a comment from the object based on its id.
 int getCommentCount(JiveObject contentObject)
          Returns the number of comments in the object.
 int getCommentCount(JiveObject contentObject, CommentResultFilter resultFilter)
          Returns the number of comments in the object based on the specified ResultFilter.
 JiveIterator<Comment> getComments(JiveObject contentObject)
          Returns an iterable for all the comments in the object.
 JiveIterator<Comment> getComments(JiveObject contentObject, CommentResultFilter resultFilter)
          Returns an Iterable for all the comments in the object that match the criteria specified by the ResultFilter.
 java.util.Date getCommentsCreationDate(JiveObject contentObject)
          Convenience method that return the date that the first comment was created.
 java.util.Date getCommentsModificationDate(JiveObject contentObject)
          Convenience method that returns the date of the latest comment modification in the object.
 CommentTreeWalker getCommentTreeWalker(JiveObject contentObject)
          Returns a CommentTreeWalker for the comments in the object.
 int getUserContentCommentCount(User user)
          Returns a count of all the comments in all content which has been authored by the supplied user.
 int getUserContentCommentCount(User user, com.jivesoftware.community.UserContentCommentResultFilter resultFilter)
          Returns a count of all the comments in all content which has been authored by the supplied user that match the criteria specified by the ResultFilter.
 JiveIterator<Comment> getUserContentComments(User user)
          Returns a JiveIterator for all the comments in all content which has been authored by the supplied user.
 JiveIterator<Comment> getUserContentComments(User user, com.jivesoftware.community.UserContentCommentResultFilter resultFilter)
          Returns a JiveIterator for all the comments in all content which has been authored by the supplied user that match the criteria specified by the ResultFilter.
 void updateComment(JiveObject contentObject, Comment comment)
          Updates an existing comment.
 
Methods inherited from interface com.jivesoftware.community.JiveManager
destroy, initialize
 

Field Detail

COMMENTS_NONE

static final int COMMENTS_NONE
Comment status for documents that do not accept comments.

See Also:
Constant Field Values

COMMENTS_OPEN

static final int COMMENTS_OPEN
Comment status for documents that do accept comments.

See Also:
Constant Field Values

COMMENTS_CLOSED

static final int COMMENTS_CLOSED
Comment status for documents that may have allowed comments in the past but presently do not accept comments.

See Also:
Constant Field Values

COMMENTS_DEFAULT

static final int COMMENTS_DEFAULT
The default comment status for a document.

See Also:
Constant Field Values
Method Detail

getCommentCount

int getCommentCount(JiveObject contentObject)
Returns the number of comments in the object.

Parameters:
contentObject - the JiveContentObject to get a comment count for.
Returns:
the number of comments in the object.

getCommentCount

int getCommentCount(JiveObject contentObject,
                    CommentResultFilter resultFilter)
Returns the number of comments in the object based on the specified ResultFilter. This is useful for determining such things as the number of comments in a date range, etc.

Parameters:
contentObject - the JiveContentObject to get a comment count for.
resultFilter - a resultFilter to limit the query on.
Returns:
the number of comments in the object based on the filter.

getComments

JiveIterator<Comment> getComments(JiveObject contentObject)
Returns an iterable for all the comments in the object.

Parameters:
contentObject - the JiveContentObject to get comments for.
Returns:
an iterable for the comments in the object.

getComments

JiveIterator<Comment> getComments(JiveObject contentObject,
                                  CommentResultFilter resultFilter)
Returns an Iterable for all the comments in the object that match the criteria specified by the ResultFilter.

Parameters:
contentObject - the JiveContentObject to get comments for.
resultFilter - a ResultFilter object to perform filtering and sorting with.
Returns:
an Iterable for the comments in the object that match the ResultFilter.

getCommentTreeWalker

CommentTreeWalker getCommentTreeWalker(JiveObject contentObject)
Returns a CommentTreeWalker for the comments in the object. A CommentTreeWalker is used to navigate through the tree of comments in a hierarchical manner.

Parameters:
contentObject - the JiveContentObject to get a tree walker for.
Returns:
a CommentTreeWalker for the comments in the object.

getCommentsCreationDate

java.util.Date getCommentsCreationDate(JiveObject contentObject)
Convenience method that return the date that the first comment was created.

Parameters:
contentObject - the JiveContentObject to get creation date for.
Returns:
the date that the first comment was created.

getCommentsModificationDate

java.util.Date getCommentsModificationDate(JiveObject contentObject)
Convenience method that returns the date of the latest comment modification in the object.

Parameters:
contentObject - the JiveContentObject to get a modification date for.
Returns:
the date of the latest comment modification in the object.

getComment

Comment getComment(JiveObject contentObject,
                   long commentID)
                   throws CommentNotFoundException,
                          UnauthorizedException
Returns a comment from the object based on its id.

Parameters:
contentObject - the JiveContentObject to get the comment for.
commentID - the ID of the comment to get from the object.
Returns:
a comment from the object based on its id.
Throws:
CommentNotFoundException - if the commentID can't be found and/or doesn't belong to the object.
UnauthorizedException - if the user doesn't have permissions to view the comment.

addComment

void addComment(JiveObject contentObject,
                Comment newComment)
                throws RejectedException,
                       UnauthorizedException
Adds a new comment (no parent) to the object.

Parameters:
contentObject - the JiveContentObject to add the comment to.
newComment - comment to add to the object.
Throws:
RejectedException - if one of the installed interceptors prevents the comment from being posted.
UnauthorizedException - if user does not have CREATE_COMMENT permissions.
java.lang.IllegalStateException - if the object hasn't yet been added to a community.

addComment

void addComment(JiveObject contentObject,
                Comment parentComment,
                Comment newComment)
                throws RejectedException,
                       UnauthorizedException
Adds a new comment having a parent comment to the object.

Parameters:
contentObject - the JiveContentObject to add the comment to.
parentComment - the comment in the object that will be the parent to the new comment.
newComment - comment to add to the object under the parent.
Throws:
RejectedException - if one of the installed interceptors prevents the comment from being posted.
UnauthorizedException - if user does not have CREATE_COMMENT permissions.
java.lang.IllegalStateException - if the object hasn't yet been added to a community.

createComment

Comment createComment(JiveObject contentObject,
                      User user,
                      java.lang.String body)
                      throws UnauthorizedException,
                             RejectedException
Create a new comment. If the user is null the comment will be anonymous.

Parameters:
contentObject - the JiveContentObject to create a comment for.
user - the author of the comment.
body - the body of the comment.
Returns:
a Comment object.
Throws:
UnauthorizedException - if user does not have permissions.
RejectedException - if the comment status for this object is not COMMENTS_OPEN

updateComment

void updateComment(JiveObject contentObject,
                   Comment comment)
                   throws UnauthorizedException
Updates an existing comment.

Parameters:
contentObject - the JiveContentObject to which the comment belongs.
comment - the updated comment
Throws:
UnauthorizedException - if the user does not have permissions

deleteComment

void deleteComment(JiveObject contentObject,
                   Comment comment)
                   throws UnauthorizedException
Deletes a comment in the object. Deleting a comment also deletes all of its children comments. The search index and other resources that referenced the comment and its children will also be updated appropriately.

Parameters:
contentObject - the JiveContentObject to wich the comment belongs.
comment - the comment to delete
Throws:
java.lang.IllegalArgumentException - if the comment does not belong to the object.
UnauthorizedException - if user does not have administrator permissions.

deleteComment

void deleteComment(JiveObject contentObject,
                   Comment comment,
                   boolean recursive)
                   throws UnauthorizedException
Deletes a comment in the object. The search index and other resources that referenced the comment will also be updated appropriately.

Parameters:
contentObject - the JiveContentObject to wich the comment belongs.
comment - the comment to delete
recursive - true to delete all the child comments, false to leave the children.
Throws:
java.lang.IllegalArgumentException - if the comment does not belong to the object.
UnauthorizedException - if user does not have administrator permissions.

deleteAllComments

void deleteAllComments(JiveObject contentObject)
                       throws UnauthorizedException
Deletes all comments on the object.

Parameters:
contentObject - the JiveContentObject to delete all comments for.
Throws:
UnauthorizedException - if user does not have administrator permissions.

getUserContentCommentCount

int getUserContentCommentCount(User user)
Returns a count of all the comments in all content which has been authored by the supplied user.

Parameters:
user - the User whose content will be searched for comments.
Returns:
a count of comments.

getUserContentCommentCount

int getUserContentCommentCount(User user,
                               com.jivesoftware.community.UserContentCommentResultFilter resultFilter)
Returns a count of all the comments in all content which has been authored by the supplied user that match the criteria specified by the ResultFilter.

Parameters:
user - the User whose content will be searched for comments.
resultFilter - a ResultFilter object to perform filtering and sorting with.
Returns:
a count of the comments that match the ResultFilter.

getUserContentComments

JiveIterator<Comment> getUserContentComments(User user)
Returns a JiveIterator for all the comments in all content which has been authored by the supplied user.

Parameters:
user - the User whose content will be searched for comments.
Returns:
a JiveIterator for the comments in the object that match the ResultFilter.

getUserContentComments

JiveIterator<Comment> getUserContentComments(User user,
                                             com.jivesoftware.community.UserContentCommentResultFilter resultFilter)
Returns a JiveIterator for all the comments in all content which has been authored by the supplied user that match the criteria specified by the ResultFilter.

Parameters:
user - the User whose content will be searched for comments.
resultFilter - a ResultFilter object to perform filtering and sorting with.
Returns:
a JiveIterator for the comments in the object that match the ResultFilter.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.