Class Comment

All Implemented Interfaces:
Searchable, Content, Addressable, ContentTypeAware, HasLinkWikiMarkup, Versioned, RelatableEntity, EditableLabelable, Labelable, Contained<ContentEntityObject>, ContentConvertible, Spaced, Serializable, Cloneable, Comparable<ContentEntityObject>

See Also:
  • Field Details

    • CONTENT_TYPE

      public static final String CONTENT_TYPE
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
  • Constructor Details

    • Comment

      public Comment()
  • Method Details

    • getContentEntityObject

      public ContentEntityObject getContentEntityObject()
    • getContainer

      public @Nullable 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)
    • 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()
      Overrides:
      clone in class ContentEntityObject
    • 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
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class ContentEntityObject
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ContentEntityObject