Package com.atlassian.confluence.pages
Class Comment
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- All Implemented Interfaces:
Searchable
,Content
,Addressable
,ContentTypeAware
,HasLinkWikiMarkup
,Versioned
,RelatableEntity
,EditableLabelable
,Labelable
,Contained<ContentEntityObject>
,ContentConvertible
,Spaced
,Serializable
,Cloneable
,Comparable<ContentEntityObject>
public class Comment extends ContentEntityObject implements HasLinkWikiMarkup, Spaced, ContentConvertible, Contained<ContentEntityObject>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description 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 formatstatic String
ORIGINAL_SELECTION_PROP
ContentProperty
key for original selection text of the inline comment-
Fields inherited from class com.atlassian.confluence.core.ContentEntityObject
COLLABORATIVE_EDITING_UUID, CONFLUENCE_RECOVERY, CONFLUENCE_RECOVERY_WITH_EXTERNAL_CHANGE, CONTENT_RESTORED_SYNC_REV_SOURCE, CREATED, CURRENT, DELETED, DELETED_BY, DELETED_BY_ANON_VALUE, DRAFT, DUMMY_SYNC_REV, LIMITED_MODE_SYNC_REV_SOURCE, MODIFIED, SHARE_ID, SYNC_REV, SYNC_REV_SOURCE, SYNCHRONY_ACK_SYNC_REV_SOURCE, SYNCHRONY_RECOVERY, SYNCHRONY_RECOVERY_WITH_EXTERNAL_CHANGE, SYNCHRONY_SYNC_REV_SOURCE
-
Fields inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
INITIAL_VERSION
-
-
Constructor Summary
Constructors Constructor Description Comment()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addChild(Comment child)
Object
clone()
void
convertToHistoricalVersion()
Remove all data from the object that does not need to be saved by historical versions.boolean
equals(Object obj)
List<Comment>
getChildren()
@Nullable ContentEntityObject
getContainer()
ContentEntityObject
getContentEntityObject()
ContentId
getContentId()
Returns theContentId
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.Comment
getParent()
Space
getSpace()
String
getSpaceKey()
Deprecated.CommentStatus
getStatus()
Get the status of commentDate
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()
int
hashCode()
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 inlinevoid
setParent(Comment parent)
void
setStatus(CommentStatus status)
Set status for commentboolean
shouldConvertToContent()
-
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, applyChildVersioningPolicy, applyChildVersioningPolicy, compareTo, ensureAttachmentBelongsToContent, getAttachmentManager, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getAttachmentUrlPath, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getCollaborativeEditingUuid, getComments, getContainerContent, getContentPermission, getContentPermissionSet, getContentStatus, getContentStatusObject, getCustomContent, getDefaultBodyType, getEntity, getExcerpt, getIdAsString, getLatestVersionId, getLatestVersionsOfAttachments, getLowerTitle, getOriginalVersionId, getOutgoingLinks, getPermissions, getProperties, getRenderedVersionComment, getSearchableDependants, getSelector, getShareId, getSynchronyRevision, getSynchronyRevisionSource, getTitle, getTrashDate, getTypeEnum, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isDraft, isIndexable, isUnpublished, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeCustomContent, removeOutgoingLink, replaceContentProperties, restore, restoreDependents, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setCollaborativeEditingUuid, setComments, setContainerContent, setContentPropertiesFrom, setContentStatus, setOriginalVersion, setOriginalVersionId, setOutgoingLinks, setShareId, setSynchronyRevision, setSynchronyRevisionSource, setTitle, setVersionComment, sharedAccessAllowed, sharedAccessAllowed, toPageContext, toString, trash, trash, trashDependents, wasCreatedBy
-
Methods inherited from class com.atlassian.confluence.core.AbstractLabelableEntityObject
addLabelling, getGlobalLabels, getLabelCount, getLabellings, getLabels, getLabelsForDisplay, getPersonalLabels, getTeamLabels, getVisibleLabels, isFavourite, removeLabelling, setLabellings
-
Methods inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
getConfluenceRevision, getLatestVersion, getVersion, getVersionChildPolicy, isLatestVersion, isNew, 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.confluence.core.Addressable
getId
-
Methods inherited from interface com.atlassian.confluence.pages.ContentConvertible
getSelector
-
Methods inherited from interface com.atlassian.confluence.labels.EditableLabelable
getId, isPersistent
-
Methods inherited from interface com.atlassian.bonnie.Searchable
getId
-
-
-
-
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
-
-
Method Detail
-
getContentEntityObject
public ContentEntityObject getContentEntityObject()
-
getContainer
public @Nullable ContentEntityObject getContainer()
- Specified by:
getContainer
in interfaceContained<ContentEntityObject>
- Returns:
- the owner of this content object. Can be null.
- Since:
- 5.6
-
setContainer
public void setContainer(ContentEntityObject container)
-
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 interfaceAddressable
- Overrides:
getDisplayTitle
in classContentEntityObject
- Returns:
- the display title
-
getUrlPath
public String getUrlPath()
- Specified by:
getUrlPath
in interfaceAddressable
- Specified by:
getUrlPath
in classContentEntityObject
-
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 interfaceContentTypeAware
- Specified by:
getType
in classContentEntityObject
- 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 classContentEntityObject
-
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)
-
addChild
public void addChild(Comment child)
-
getDescendantsCount
public int getDescendantsCount()
-
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 interfaceVersioned
- Overrides:
convertToHistoricalVersion
in classContentEntityObject
-
removeChild
public void removeChild(Comment child)
-
clone
public Object clone()
- Overrides:
clone
in classContentEntityObject
-
getLinkWikiMarkup
public String getLinkWikiMarkup()
- Specified by:
getLinkWikiMarkup
in interfaceHasLinkWikiMarkup
- Returns:
- the wiki markup used to link to this content
-
getContentTypeObject
public ContentType getContentTypeObject()
- Specified by:
getContentTypeObject
in interfaceContentConvertible
- Returns:
- the api ContentType that this ContentConvertible converts to
-
getContentId
public ContentId getContentId()
Returns theContentId
for this Comment.- Specified by:
getContentId
in interfaceContentConvertible
- Overrides:
getContentId
in classContentEntityObject
- Returns:
- the ContentId representation of this comment's id
-
shouldConvertToContent
public boolean shouldConvertToContent()
- Specified by:
shouldConvertToContent
in interfaceContentConvertible
- 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
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classContentEntityObject
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classContentEntityObject
-
-