Class AbstractPage

All Implemented Interfaces:
Searchable, Content, Addressable, ContentTypeAware, HasLinkWikiMarkup, Versioned, RelatableEntity, EditableLabelable, Labelable, Spaced, Serializable, Cloneable, Comparable<ContentEntityObject>
Direct Known Subclasses:
BlogPost, Page

public abstract class AbstractPage extends SpaceContentEntityObject implements HasLinkWikiMarkup
Parent of the concrete Page and BlogPost classes
See Also:
  • Constructor Details

    • AbstractPage

      public AbstractPage()
  • Method Details

    • isValidPageTitle

      @EnsuresNonNullIf(expression="title", result=true) public static boolean isValidPageTitle(String title)
    • isValidTitleLength

      public static boolean isValidTitleLength(String title)
    • setTitle

      public void setTitle(String title)
      Overrides:
      setTitle in class ContentEntityObject
    • 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 SpaceContentEntityObject
    • getOriginalVersionPage

      public AbstractPage getOriginalVersionPage()
      if this page is a historical version, then this method returns the current/latest version of this page if this page is the latest version, then this returns null this method name should really be refactored to getCurrentVersionOfPage()
    • setOriginalVersionPage

      public void setOriginalVersionPage(AbstractPage originalVersionPage)
    • getPreviousVersion

      public int getPreviousVersion()
      Convenience method to get the immediately prior version since we can't perform arithmetic in velocity (assume that versions are sequential) Method is used in email templates where session is not available. Hence we cannot load previousVersions to return a page object
    • getSearchableDependants

      public Collection<Searchable> getSearchableDependants()
      Description copied from interface: Searchable
      When we un-index something (say, a page), we also need to un-index everything contained within that page (comments, attachments), because presumably they're all about to go away.
      Specified by:
      getSearchableDependants in interface Searchable
    • getUrlPath

      @Deprecated(forRemoval=true, since="9.3") public String getUrlPath()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getUrlPath in interface Addressable
      Specified by:
      getUrlPath in class ContentEntityObject
    • isValidSpaceKey

      public boolean isValidSpaceKey()
      There is another Space.isValidSpaceKey(String) but it only validates the personal space key with a very relaxed rule
      Returns:
      true if the space key is valid
    • getPageLevelComments

      public List<Comment> getPageLevelComments()
      Returns:
      List of page-level (i.e. not inline) comments.
      Since:
      5.6
    • getTopLevelComments

      public List<Comment> getTopLevelComments()
    • getAttachmentsUrlPath

      @Deprecated(forRemoval=true, since="9.3") public String getAttachmentsUrlPath()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      getAttachmentsUrlPath in class ContentEntityObject
    • getAttachmentUrlPath

      @Deprecated(forRemoval=true, since="9.3") public String getAttachmentUrlPath(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: ContentEntityObject
      Gets the path relative to Confluence's base URL to view the given attachment in the context of this content (for example, highlighted in the content's list of attachments). Generally you will want to call Attachment.getUrlPath() instead of this method: if we ever implement view pages for individual attachments, that's the method that will be changed to point to them.

      The default implementation just returns the view page for this content.

      Overrides:
      getAttachmentUrlPath in class ContentEntityObject
      Parameters:
      attachment - one of this content's attachments
      Returns:
      the path relative to the base url to view the attachment in the context of this content.
    • getLatestVersion

      public AbstractPage getLatestVersion()
      Description copied from interface: Versioned
      Get the latest, current version of this versioned object. If this object is the current version, return this object.

      Note that drafts are a special version of a ContentEntityObject so for drafts this method should return the ContentEntityObject the drafts points to if it exists and the draft itself otherwise.

      Specified by:
      getLatestVersion in interface Versioned
      Overrides:
      getLatestVersion in class AbstractVersionedEntityObject
      Returns:
      the current version of this object.
      See Also:
    • getConfluenceRevision

      public String getConfluenceRevision()
      Overrides:
      getConfluenceRevision in class AbstractVersionedEntityObject