Class Draft

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

public class Draft extends ContentEntityObject
This is the old way of dealing with drafts in Confluence and will be deprecated soon.

See ContentEntityObject.DRAFT to see how new drafts are defined.

See Also:
  • Field Details

  • Constructor Details

    • Draft

      public Draft()
  • Method Details

    • isDraft

      public boolean isDraft()
      Overrides:
      isDraft in class ContentEntityObject
    • sharedAccessAllowed

      @Deprecated public boolean sharedAccessAllowed(String shareId)
      Deprecated.
      since 5.10
      Checks if this draft can be accessed by users other than the creator (shared access)

      IMPORTANT NOTE: if shared access is disallowed it prevails over permissions (only creator has access), BUT if it is allowed normal permissions still need to be checked

      All legacy drafts are private

      Overrides:
      sharedAccessAllowed in class ContentEntityObject
      Parameters:
      shareId - Used to check for access if needed
      Returns:
      true if this draft can be accessed given a share id, false otherwise
      See Also:
    • getShareId

      public String getShareId()
      Overrides:
      getShareId in class ContentEntityObject
      See Also:
    • isUnpublished

      public boolean isUnpublished()
      Overrides:
      isUnpublished in class ContentEntityObject
    • isAuthor

      @Deprecated public boolean isAuthor(com.atlassian.user.User user)
    • isNewPage

      public boolean isNewPage()
      Returns true if the draft is for a new piece of content, otherwise false.
    • isIndexable

      public boolean isIndexable()
      Description copied from class: ContentEntityObject
      Content entity objects that are historical versions should not be indexed.
      Specified by:
      isIndexable in interface Searchable
      Overrides:
      isIndexable in class ContentEntityObject
    • isBlank

      public boolean isBlank()
      Returns:
      true if this draft has a an empty title and content that is null or empty string
    • getUrlPath

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

      public String getNameForComparison()
      Description copied from class: ContentEntityObject
      Subclasses should implement this method, giving a String back so that the content can be alphabetically sorted in a mixed-type list of content-entities.
      Specified by:
      getNameForComparison 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
    • getDraftSpaceKey

      public String getDraftSpaceKey()
    • setDraftSpaceKey

      public void setDraftSpaceKey(String draftSpaceKey)
    • setPageVersion

      public void setPageVersion(int pageVersion)
    • getPageVersion

      public int getPageVersion()
    • getPageId

      public String getPageId()
      Gets the id of the AbstractPage which this is a draft of, as a String. Note that it's currently stored as a String in the database, but the String always represents the id of a page, which is always representable as a long.
    • getPageIdAsLong

      public Long getPageIdAsLong()
    • setPageId

      public void setPageId(String pageId)
    • setPageId

      public void setPageId(Long pageId)
    • getDraftType

      public String getDraftType()
    • setDraftType

      public void setDraftType(String draftType)
    • getContentId

      public ContentId getContentId()
      Returns the ContentId for this Draft.
      Overrides:
      getContentId in class ContentEntityObject
      Returns:
      the ContentId representation of this Draft's id
    • toString

      public String toString()
      Overrides:
      toString in class ContentEntityObject
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class ContentEntityObject