com.atlassian.confluence.pages
Class Page

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.core.SpaceContentEntityObject
                          extended by com.atlassian.confluence.pages.AbstractPage
                              extended by com.atlassian.confluence.pages.Page
All Implemented Interfaces:
com.atlassian.bonnie.Searchable, Content, Addressable, ContentTypeAware, HasLinkWikiMarkup, Hierarchical<Page>, Versioned, EditableLabelable, Labelable, ContentConvertible, Spaced, Serializable, Cloneable, Comparable

public class Page
extends AbstractPage
implements Hierarchical<Page>, ContentConvertible

Represents a Page within Confluence.

See Also:
Serialized Form

Field Summary
static String CONTENT_TYPE
           
 
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
Page()
           
 
Method Summary
 void addChild(Page child)
           
 void convertToHistoricalVersion()
          Remove all data from the object that does not need to be saved by historical versions.
 List<Page> getAncestors()
          Gets the list of ancestors of this page (its parents, and its parents parents, right up to the root level of the containing space).
 List<Page> getChildren()
           
 ContentId getContentId()
          Returns the ContentId for this Page.
 ContentType getContentTypeObject()
           
 List<Page> getDescendants()
           
 List<Page> getDescendents()
          Deprecated. since 5.5.1. Use getDescendants()
 String getLinkWikiMarkup()
           
 String getNameForComparison()
          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.
 Page getParent()
           
 Integer getPosition()
           
 List<Page> getSortedChildren()
           
 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.
 boolean hasChildren()
           
 void incPosition()
           
 boolean isHomePage()
           
 boolean isIndexable()
          pages, blogs etc that aren't not associated with a space (either because they are historical or corrupt) should not be indexed if they are indexed, and returned in search results, they are broken and are therefore useless
 boolean isRootLevel()
           
 void remove(PageManager pageManager)
          Sever any homepage
 void removeChild(Page child)
           
 void setAncestors(List<Page> ancestors)
          This should only ever be set by Hibernate.
 void setChildren(List<Page> children)
           
 void setParent(Page parent)
          Deprecated. Since 1.1. Do not call this method. It exists solely for hibernate to use. Use #setParentPage instead. I would have made this method private, but CGLIB was complaining.
 void setParentPage(Page parent)
          Public setter that makes sure that the parent page is valid
 void setPosition(Integer position)
           
 void setSpace(Space newSpace)
           
 void severParentChildRelationships()
          sever parent/child relationships
 boolean shouldConvertToContent()
           
 void trash()
          places content in trash can
 
Methods inherited from class com.atlassian.confluence.pages.AbstractPage
getAttachmentsUrlPath, getAttachmentUrlPath, getLatestVersion, getOriginalVersionPage, getPageLevelComments, getPreviousVersion, getSearchableDependants, getTopLevelComments, getUrlPath, hasInvalidTitleCharacters, isValidPageTitle, isValidPageTitleCharacter, isValidTitleLength, setContentPropertiesFromDraft, setOriginalVersionPage, setTitle
 
Methods inherited from class com.atlassian.confluence.core.SpaceContentEntityObject
getSpace, getSpaceKey, hashCode, isInSpace
 
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, addReferralLink, addTrackbackLink, applyChildVersioningPolicy, clone, compareTo, ensureAttachmentBelongsToContent, equals, getAttachmentNamed, getAttachments, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getComments, getContainerContent, getContentEntityObject, getContentPermission, getContentPermissionSet, getContentStatus, getDefaultBodyType, getDisplayTitle, getEntity, getExcerpt, getIdAsString, getLatestVersionsOfAttachments, getOutgoingLinks, getPermissions, getProperties, getReferralLinks, getRenderedVersionComment, getTitle, getTrackbackLinks, getTypeEnum, getUserAccessor, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isRecentlyUpdatedFor, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeCustomContent, removeOutgoingLink, removeReferralLink, removeTrackbackLink, replaceContentProperties, restore, restoreDependents, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setComments, setContainerContent, setContentStatus, setOutgoingLinks, setReferralLinks, setTrackbackLinks, setUserAccessor, setVersionComment, toPageContext, toString, 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
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
Constructor Detail

Page

public Page()
Method Detail

setPosition

public void setPosition(Integer position)

incPosition

public void incPosition()

getPosition

public Integer getPosition()

isRootLevel

public boolean isRootLevel()
Specified by:
isRootLevel in interface Hierarchical<Page>

getParent

public Page getParent()
Specified by:
getParent in interface Hierarchical<Page>

setParent

@Deprecated
public void setParent(Page parent)
Deprecated. Since 1.1. Do not call this method. It exists solely for hibernate to use. Use #setParentPage instead. I would have made this method private, but CGLIB was complaining.

Specified by:
setParent in interface Hierarchical<Page>

setParentPage

public void setParentPage(Page parent)
Public setter that makes sure that the parent page is valid

Parameters:
parent - the page to set as this page's parent
Throws:
IllegalArgumentException - if the parent page is in a different space.

getChildren

public List<Page> getChildren()
Specified by:
getChildren in interface Hierarchical<Page>

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface Hierarchical<Page>

getSortedChildren

public List<Page> getSortedChildren()

setChildren

public void setChildren(List<Page> children)
Specified by:
setChildren in interface Hierarchical<Page>

addChild

public void addChild(Page child)
Specified by:
addChild in interface Hierarchical<Page>

removeChild

public void removeChild(Page child)
Specified by:
removeChild in interface Hierarchical<Page>

isHomePage

public boolean isHomePage()

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

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 AbstractPage

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.

Overrides:
getNameForComparison in class SpaceContentEntityObject

severParentChildRelationships

public void severParentChildRelationships()
sever parent/child relationships


remove

public void remove(PageManager pageManager)
Sever any homepage

Overrides:
remove in class AbstractPage

getLinkWikiMarkup

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

trash

public void trash()
Description copied from class: ContentEntityObject
places content in trash can

Overrides:
trash in class ContentEntityObject

getDescendants

public List<Page> getDescendants()

getDescendents

@Deprecated
public List<Page> getDescendents()
Deprecated. since 5.5.1. Use getDescendants()


getAncestors

public List<Page> getAncestors()
Gets the list of ancestors of this page (its parents, and its parents parents, right up to the root level of the containing space). This is more efficient than repeatedly calling getParent() as it does a single join across the ancestors table instead of one query per parent.

For strange historical reasons, this list is in the opposite order you would expect. The LAST element of the list will be this page's parent.

Specified by:
getAncestors in interface Hierarchical<Page>
Returns:
the list of ancestors of the page, ordered from the root of the space.

setAncestors

public void setAncestors(List<Page> ancestors)
This should only ever be set by Hibernate.


setSpace

public void setSpace(Space newSpace)
Overrides:
setSpace in class SpaceContentEntityObject

isIndexable

public boolean isIndexable()
Description copied from class: SpaceContentEntityObject
pages, blogs etc that aren't not associated with a space (either because they are historical or corrupt) should not be indexed if they are indexed, and returned in search results, they are broken and are therefore useless

Specified by:
isIndexable in interface com.atlassian.bonnie.Searchable
Overrides:
isIndexable in class SpaceContentEntityObject

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 Page.

Specified by:
getContentId in interface ContentConvertible
Overrides:
getContentId in class ContentEntityObject
Returns:
the ContentId representation of this Page'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


Copyright © 2003–2015 Atlassian. All rights reserved.