com.atlassian.confluence.pages
Class DefaultCommentManager

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultContentEntityManager
      extended by com.atlassian.confluence.pages.DefaultCommentManager
All Implemented Interfaces:
ContentEntityManager, ContentEntityManagerInternal, CommentManagerInternal, CommentManager

public class DefaultCommentManager
extends DefaultContentEntityManager
implements CommentManagerInternal

Manager for page comments.


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
attachmentManager, contentEntityObjectDao, eventManager, hibernateSessionManager, indexer, labelManager, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultCommentManager(CommentDao commentDao)
           
 
Method Summary
 Comment addCommentToObject(ContentEntityObject ceo, Comment parent, String content)
           
 Comment addCommentToObject(ContentEntityObject ceo, Comment parent, String content, NewCommentDeduplicator commentDeduplicator)
          Add a new comment if the given deduplicator determines that it's not a duplicate, or just return the existing duplicate otherwise.
 Comment addCommentToPage(AbstractPage page, Comment parent, String content)
           
 Map<com.atlassian.bonnie.Searchable,Integer> countComments(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
           
 int countComments(com.atlassian.bonnie.Searchable searchable)
           
 Map<Long,Integer> countUnresolvedComments(Collection<Long> containerIds)
          Count unresolved comments of comment containers.
 PageResponse<Comment> getChildren(Comment comment, LimitedRequest pageRequest, Depth depth, com.google.common.base.Predicate<? super Comment>... predicates)
          Returns the children of a comment, limited to the pagination requested.
 Comment getComment(long id)
           
 List<Comment> getPageComments(long pageId, Date since)
          The service get all page comments (page level comments and inline comments)
 List<Comment> getPageComments(long pageId, Date since, String ignoreUsername)
          The service get all page comments (page level comments and inline comments) from a particular date except for comments by the given username.
 PageResponse<Comment> getPageComments(long pageId, LimitedRequest pageRequest, Depth depth, com.google.common.base.Predicate<? super Comment>... predicates)
          Returns the children of a Page or Blogpost, limited to the pagination requested.
 List<Comment> getPageLevelComments(long pageId, Date since)
          The service get all page level comments
 Iterator getRecentlyUpdatedComments(Space space, int maxResults)
           
protected  void publishCreateEvent(ContentEntityObject obj)
          This method publishes *CreateEventss.
protected  void publishCreateEvent(ContentEntityObject obj, SaveContext saveContext)
           
protected  void publishRemoveEvent(ContentEntityObject obj)
          This method publishes *RemoveEvents.
protected  void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
          This method publishes *UpdateEvents.
 void removeCommentFromObject(long id)
           
 void removeCommentFromPage(long id)
           
 void setCommentDao(CommentDao commentDao)
           
 void updateCommentContent(Comment comment, String content)
           
 
Methods inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
getBodyContentForRevert, getById, getById, getById, getEventManager, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion, setAttachmentManager, setContentEntityObjectDao, setEventManager, setHibernateSessionManager, setIndexer, setLabelManager, setLinkManager, suppressNotificationsOnEventIfRequired, updateContentLinkingTo, updateContentLinkingTo, updateOutgoingLinksInContent, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getById, getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Constructor Detail

DefaultCommentManager

public DefaultCommentManager(CommentDao commentDao)
Method Detail

setCommentDao

public void setCommentDao(CommentDao commentDao)

getComment

public Comment getComment(long id)
Specified by:
getComment in interface CommentManager

addCommentToPage

public Comment addCommentToPage(AbstractPage page,
                                Comment parent,
                                String content)
Specified by:
addCommentToPage in interface CommentManager

addCommentToObject

public Comment addCommentToObject(ContentEntityObject ceo,
                                  Comment parent,
                                  String content)
Specified by:
addCommentToObject in interface CommentManager

addCommentToObject

public Comment addCommentToObject(ContentEntityObject ceo,
                                  Comment parent,
                                  String content,
                                  NewCommentDeduplicator commentDeduplicator)
Description copied from interface: CommentManager
Add a new comment if the given deduplicator determines that it's not a duplicate, or just return the existing duplicate otherwise.

Specified by:
addCommentToObject in interface CommentManager

updateCommentContent

public void updateCommentContent(Comment comment,
                                 String content)
Specified by:
updateCommentContent in interface CommentManager

removeCommentFromPage

public void removeCommentFromPage(long id)
Specified by:
removeCommentFromPage in interface CommentManager

removeCommentFromObject

public void removeCommentFromObject(long id)
Specified by:
removeCommentFromObject in interface CommentManager

getRecentlyUpdatedComments

public Iterator getRecentlyUpdatedComments(Space space,
                                           int maxResults)
Specified by:
getRecentlyUpdatedComments in interface CommentManager

getPageComments

public List<Comment> getPageComments(long pageId,
                                     Date since)
Description copied from interface: CommentManager
The service get all page comments (page level comments and inline comments)

Specified by:
getPageComments in interface CommentManager
Parameters:
pageId - page id of comment
since - comment time
Returns:
all comment

getPageComments

public List<Comment> getPageComments(long pageId,
                                     Date since,
                                     String ignoreUsername)
Description copied from interface: CommentManager
The service get all page comments (page level comments and inline comments) from a particular date except for comments by the given username.

Specified by:
getPageComments in interface CommentManager
Parameters:
pageId - page id of comment
since - comment time
ignoreUsername - username excepted
Returns:
all comment

getPageComments

public PageResponse<Comment> getPageComments(long pageId,
                                             LimitedRequest pageRequest,
                                             Depth depth,
                                             com.google.common.base.Predicate<? super Comment>... predicates)
Description copied from interface: CommentManagerInternal
Returns the children of a Page or Blogpost, limited to the pagination requested.

Specified by:
getPageComments in interface CommentManagerInternal
Parameters:
pageId - the id of the page or blogpost to find children for
pageRequest - the pagination requested
depth - the depth to return children to
predicates - optional predicates used to filter the comments
Returns:
the paginated response of Comment entities

countComments

public Map<com.atlassian.bonnie.Searchable,Integer> countComments(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
Specified by:
countComments in interface CommentManager

countComments

public int countComments(com.atlassian.bonnie.Searchable searchable)
Specified by:
countComments in interface CommentManager

countUnresolvedComments

public Map<Long,Integer> countUnresolvedComments(Collection<Long> containerIds)
Description copied from interface: CommentManager
Count unresolved comments of comment containers.

Specified by:
countUnresolvedComments in interface CommentManager
Parameters:
containerIds - the list of comment containers ids
Returns:
The map of container id and its unresolved comment count

getChildren

public PageResponse<Comment> getChildren(Comment comment,
                                         LimitedRequest pageRequest,
                                         Depth depth,
                                         com.google.common.base.Predicate<? super Comment>... predicates)
Description copied from interface: CommentManagerInternal
Returns the children of a comment, limited to the pagination requested.

Specified by:
getChildren in interface CommentManagerInternal
Parameters:
comment - the comment to find children for
pageRequest - the pagination requested
depth - the depth to return children to
predicates - optional predicates used to filter the comments
Returns:
the paginated response of Comment entities

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishCreateEvent in class DefaultContentEntityManager
Parameters:
obj - the created content entity object

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj,
                                  SaveContext saveContext)
Overrides:
publishCreateEvent in class DefaultContentEntityManager

publishRemoveEvent

protected void publishRemoveEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishRemoveEvent in class DefaultContentEntityManager
Parameters:
obj - the removed content entity object

publishUpdateEvent

protected void publishUpdateEvent(ContentEntityObject obj,
                                  ContentEntityObject origObj,
                                  SaveContext saveContext)
Description copied from class: DefaultContentEntityManager
This method publishes *UpdateEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishUpdateEvent in class DefaultContentEntityManager
Parameters:
obj - the updated content entity object
origObj - the old version of the content entity object, for history purpose
saveContext - the associated SaveContext

getPageLevelComments

public List<Comment> getPageLevelComments(long pageId,
                                          Date since)
Description copied from interface: CommentManager
The service get all page level comments

Specified by:
getPageLevelComments in interface CommentManager
Parameters:
pageId - page id of comment
since - comment time
Returns:
page level comments


Copyright © 2003–2015 Atlassian. All rights reserved.