com.atlassian.confluence.pages
Class Comment

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.confluence.core.ConfluenceEntityObject
          extended by com.atlassian.confluence.core.AbstractVersionedEntityObject
              extended by com.atlassian.confluence.core.AbstractLabelableEntityObject
                  extended by com.atlassian.confluence.core.ContentEntityObject
                      extended by com.atlassian.confluence.pages.Comment
All Implemented Interfaces:
com.atlassian.bonnie.Searchable, Content, Addressable, ContentTypeAware, HasLinkWikiMarkup, Versioned, EditableLabelable, Labelable, Contained<ContentEntityObject>, ContentConvertible, Spaced, Serializable, Cloneable, Comparable

public class Comment
extends ContentEntityObject
implements HasLinkWikiMarkup, Spaced, ContentConvertible, Contained<ContentEntityObject>

See Also:
Serialized Form

Field Summary
static String CONTENT_TYPE
           
static String FOOTER
          The comment will be found in the page footer (i.e.
static String INLINE
          The comment will be found in the page content (aka.
static String INLINE_PROP
          ContentProperty key for the property that indicates whether or not the comment is an inline comment.
static String MARKER_REF_PROP
          ContentProperty key for the reference to the selection's markers in storage format
static String ORIGINAL_SELECTION_PROP
          ContentProperty key for original selection text of the inline comment
 
Fields inherited from class com.atlassian.confluence.core.ContentEntityObject
CREATED, CURRENT, DELETED, MODIFIED
 
Fields inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
INITIAL_VERSION
 
Constructor Summary
Comment()
           
 
Method Summary
 void addChild(Comment child)
           
 Object clone()
           
 void convertToHistoricalVersion()
          Remove all data from the object that does not need to be saved by historical versions.
 List<Comment> getChildren()
           
 ContentEntityObject getContainer()
           
 ContentEntityObject getContentEntityObject()
           
 ContentId getContentId()
          Returns the ContentId for this Comment.
 ContentType getContentTypeObject()
           
 int getDepth()
           
 Set<String> getDescendantAuthors()
           
 int getDescendantsCount()
           
 String getDisplayTitle()
          Returns the display title.
 String getLinkWikiMarkup()
           
 String getNameForComparison()
          Since the ContentEntityObject falls back on ordering by creation date, comments should always end up being sorted in their order of posting, below the page they were created in.
 ContentEntityObject getOwner()
          Deprecated. since 5.7. Use getContainer() instead.
 AbstractPage getPage()
          Deprecated. since 4.0. Please use getOwner() instead.
 Comment getParent()
           
 Space getSpace()
           
 String getSpaceKey()
          Deprecated. 
 CommentStatus getStatus()
          Get the status of comment
 Date getThreadChangedDate()
           
 String getType()
          An easy name for the type of this content: makes it easy for things like the #contentLink macro to work out what to draw.
 String getUrlPath()
           
 boolean isInlineComment()
           
 void removeChild(Comment child)
           
 void reparentChildren(Comment newParent)
           
 void setChildren(List<Comment> children)
           
 void setContainer(ContentEntityObject container)
           
 void setInlineComment(boolean isInlineComment)
          Set if the comment is inline
 void setOwner(ContentEntityObject owner)
          Deprecated. since 4.0. Please use getContainer() instead.
 void setPage(AbstractPage page)
          Deprecated. Since 3.3 Use setContainer(ContentEntityObject)
 void setParent(Comment parent)
           
 void setStatus(CommentStatus status)
          Set status for comment
 boolean shouldConvertToContent()
           
 
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, addReferralLink, addTrackbackLink, applyChildVersioningPolicy, compareTo, ensureAttachmentBelongsToContent, equals, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getAttachmentUrlPath, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getComments, getContainerContent, getContentPermission, getContentPermissionSet, getContentStatus, getDefaultBodyType, getEntity, getExcerpt, getIdAsString, getLatestVersionsOfAttachments, getOutgoingLinks, getPermissions, getProperties, getReferralLinks, getRenderedVersionComment, getSearchableDependants, getTitle, getTrackbackLinks, getTypeEnum, getUserAccessor, getVersionComment, hasContentPermissions, hashCode, hasPermissions, isCurrent, isDeleted, isIndexable, isRecentlyUpdatedFor, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeCustomContent, removeOutgoingLink, removeReferralLink, removeTrackbackLink, replaceContentProperties, restore, restoreDependents, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setComments, setContainerContent, setContentStatus, setOutgoingLinks, setReferralLinks, setTitle, setTrackbackLinks, setUserAccessor, setVersionComment, toPageContext, toString, trash, trashDependents
 
Methods inherited from class com.atlassian.confluence.core.AbstractLabelableEntityObject
addLabelling, getGlobalLabels, getLabelCount, getLabellings, getLabels, getLabelsForDisplay, getLabelUtil, getPersonalLabels, getTeamLabels, getVisibleLabels, isFavourite, isFavourite, removeLabelling, setLabellings
 
Methods inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
getLatestVersion, getOriginalVersion, getVersion, getVersionChildPolicy, isLatestVersion, isNew, setOriginalVersion, setVersion
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
 
Methods inherited from class com.atlassian.core.bean.EntityObject
getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.bonnie.Searchable
getId
 
Methods inherited from interface com.atlassian.confluence.core.Addressable
getId
 
Methods inherited from interface com.atlassian.confluence.labels.EditableLabelable
getId, isPersistent
 

Field Detail

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

INLINE_PROP

public static final String INLINE_PROP
ContentProperty key for the property that indicates whether or not the comment is an inline comment.

Since:
5.7
See Also:
Constant Field Values

MARKER_REF_PROP

public static final String MARKER_REF_PROP
ContentProperty key for the reference to the selection's markers in storage format

Since:
5.7
See Also:
Constant Field Values

ORIGINAL_SELECTION_PROP

public static final String ORIGINAL_SELECTION_PROP
ContentProperty key for original selection text of the inline comment

Since:
5.7
See Also:
Constant Field Values

INLINE

public static final String INLINE
The comment will be found in the page content (aka. inline) if the location query param contains this value

Since:
5.7
See Also:
Constant Field Values

FOOTER

public static final String FOOTER
The comment will be found in the page footer (i.e. page comment section) if the location query param contains this value

Since:
5.7
See Also:
Constant Field Values
Constructor Detail

Comment

public Comment()
Method Detail

getContentEntityObject

public ContentEntityObject getContentEntityObject()
Overrides:
getContentEntityObject in class ContentEntityObject

getContainer

public ContentEntityObject getContainer()
Specified by:
getContainer in interface Contained<ContentEntityObject>
Returns:
the owner of this content object. Can be null.
Since:
5.6

setContainer

public void setContainer(ContentEntityObject container)

getOwner

@Deprecated
public ContentEntityObject getOwner()
Deprecated. since 5.7. Use getContainer() instead.


setOwner

@Deprecated
public void setOwner(ContentEntityObject owner)
Deprecated. since 4.0. Please use getContainer() instead.


getPage

@Deprecated
public AbstractPage getPage()
Deprecated. since 4.0. Please use getOwner() instead.

Please use getOwner() instead.


setPage

@Deprecated
public void setPage(AbstractPage page)
Deprecated. Since 3.3 Use setContainer(ContentEntityObject)


getSpace

public Space getSpace()
Specified by:
getSpace in interface Spaced

getDisplayTitle

public String getDisplayTitle()
Description copied from class: ContentEntityObject
Returns the display title. Some entities don't have titles for identification. For example, personal information objects use the user's fullname. Override this method to provide a custom title.

Specified by:
getDisplayTitle in interface Addressable
Overrides:
getDisplayTitle in class ContentEntityObject
Returns:
the display title

getUrlPath

public String getUrlPath()
Specified by:
getUrlPath in interface Addressable
Specified by:
getUrlPath in class ContentEntityObject

getType

public String getType()
Description copied from class: ContentEntityObject
An easy name for the type of this content: makes it easy for things like the #contentLink macro to work out what to draw.

This is a bit of a hack, but it saves heaps of code elsewhere, especially since we tend to get back these objects wrapped in all sorts of Hibernate CGLIB stuff.

Specified by:
getType in interface ContentTypeAware
Specified by:
getType in class ContentEntityObject
Returns:
the content type

getNameForComparison

public String getNameForComparison()
Since the ContentEntityObject falls back on ordering by creation date, comments should always end up being sorted in their order of posting, below the page they were created in. Nifty, eh.

Specified by:
getNameForComparison in class ContentEntityObject

getSpaceKey

@Deprecated
public String getSpaceKey()
Deprecated. 

convenience method for lucene to retrieve the key of the space this comment belongs to

Returns:
the space key

getParent

public Comment getParent()

setParent

public void setParent(Comment parent)

getChildren

public List<Comment> getChildren()

setChildren

public void setChildren(List<Comment> children)

addChild

public void addChild(Comment child)

getDescendantsCount

public int getDescendantsCount()

getDescendantAuthors

public Set<String> getDescendantAuthors()

getDepth

public int getDepth()

getThreadChangedDate

public Date getThreadChangedDate()

reparentChildren

public void reparentChildren(Comment newParent)

convertToHistoricalVersion

public void convertToHistoricalVersion()
Description copied from interface: Versioned
Remove all data from the object that does not need to be saved by historical versions. For versioned objects that are persisted, this includes removing associations with other persisted objects that may otherwise cause us to break the expected arity of the database relations.

When using Hibernate to persist versioned objects, take special care to null any field that might contain a Hibernate-persisted collection, as Hibernate does not allow two different persistent objects to refer to the same persisted collection at the same time.

Specified by:
convertToHistoricalVersion in interface Versioned
Overrides:
convertToHistoricalVersion in class ContentEntityObject

removeChild

public void removeChild(Comment child)

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class ContentEntityObject
Throws:
CloneNotSupportedException

getLinkWikiMarkup

public String getLinkWikiMarkup()
Specified by:
getLinkWikiMarkup in interface HasLinkWikiMarkup
Returns:
the wiki markup used to link to this content

getContentTypeObject

public ContentType getContentTypeObject()
Specified by:
getContentTypeObject in interface ContentConvertible
Returns:
the api ContentType that this ContentConvertible converts to

getContentId

public ContentId getContentId()
Returns the ContentId for this Comment.

Specified by:
getContentId in interface ContentConvertible
Overrides:
getContentId in class ContentEntityObject
Returns:
the ContentId representation of this comment's id

shouldConvertToContent

public boolean shouldConvertToContent()
Specified by:
shouldConvertToContent in interface ContentConvertible
Returns:
true if the implementer wants to be part of the core API (default value), false otherwise

isInlineComment

public boolean isInlineComment()
Returns:
true if the comment is inline
Since:
5.7

setInlineComment

public void setInlineComment(boolean isInlineComment)
Set if the comment is inline

Parameters:
isInlineComment -
Since:
5.7

getStatus

public CommentStatus getStatus()
Get the status of comment

Returns:
CommentStatus bean
Since:
5.7

setStatus

public void setStatus(CommentStatus status)
Set status for comment

Parameters:
status - CommentStatus
Since:
5.7


Copyright © 2003–2015 Atlassian. All rights reserved.