Package com.atlassian.confluence.pages
Class AbstractPage
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- All Implemented Interfaces:
Searchable
,Content
,Addressable
,ContentTypeAware
,HasLinkWikiMarkup
,Versioned
,RelatableEntity
,EditableLabelable
,Labelable
,Spaced
,Serializable
,Cloneable
,Comparable<ContentEntityObject>
public abstract class AbstractPage extends SpaceContentEntityObject implements HasLinkWikiMarkup
Parent of the concrete Page and BlogPost classes- See Also:
- Serialized Form
-
-
Field Summary
-
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, 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 AbstractPage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
convertToHistoricalVersion()
Remove all data from the object that does not need to be saved by historical versions.String
getAttachmentsUrlPath()
String
getAttachmentUrlPath(Attachment attachment)
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).String
getConfluenceRevision()
String
getEditUrlPath()
AbstractPage
getLatestVersion()
Get the latest, current version of this versioned object.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()List<Comment>
getPageLevelComments()
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.Collection<Searchable>
getSearchableDependants()
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.List<Comment>
getTopLevelComments()
String
getUrlPath()
static boolean
isValidPageTitle(String title)
static boolean
isValidTitleLength(String title)
void
remove(PageManager pageManager)
Remove this page from the world.void
setContentPropertiesFromDraft(Draft draft)
Deprecated.void
setOriginalVersionPage(AbstractPage originalVersionPage)
void
setTitle(String title)
-
Methods inherited from class com.atlassian.confluence.core.SpaceContentEntityObject
getNameForComparison, getSpace, getSpaceKey, hashCode, isIndexable, isInSpace, setSpace
-
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, applyChildVersioningPolicy, applyChildVersioningPolicy, clone, compareTo, ensureAttachmentBelongsToContent, equals, getAttachmentManager, getAttachmentNamed, getAttachments, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getCollaborativeEditingUuid, getComments, getContainerContent, getContentId, getContentPermission, getContentPermissionSet, getContentStatus, getContentStatusObject, getCustomContent, getDefaultBodyType, getDisplayTitle, getEntity, getExcerpt, getIdAsString, getLatestVersionId, getLatestVersionsOfAttachments, getLowerTitle, getOriginalVersionId, getOutgoingLinks, getPermissions, getProperties, getRenderedVersionComment, getSelector, getShareId, getSynchronyRevision, getSynchronyRevisionSource, getTitle, getTrashDate, getType, getTypeEnum, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isDraft, 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, 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
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.labels.EditableLabelable
getId, isPersistent
-
Methods inherited from interface com.atlassian.confluence.core.HasLinkWikiMarkup
getLinkWikiMarkup
-
Methods inherited from interface com.atlassian.bonnie.Searchable
getId
-
-
-
-
Method Detail
-
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 classContentEntityObject
-
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 classSpaceContentEntityObject
-
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
-
remove
public void remove(PageManager pageManager)
Remove this page from the world. This method should sever any inverse relationships this page may have with other objects.
-
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 interfaceSearchable
- Overrides:
getSearchableDependants
in classContentEntityObject
-
getUrlPath
public String getUrlPath()
- Specified by:
getUrlPath
in interfaceAddressable
- Specified by:
getUrlPath
in classContentEntityObject
-
getEditUrlPath
public String getEditUrlPath()
- Returns:
- String a URL to edit the page in the Confluence editor.
- Since:
- 6.1
-
getPageLevelComments
public List<Comment> getPageLevelComments()
- Returns:
- List of page-level (i.e. not inline) comments.
- Since:
- 5.6
-
getAttachmentsUrlPath
public String getAttachmentsUrlPath()
- Overrides:
getAttachmentsUrlPath
in classContentEntityObject
-
getAttachmentUrlPath
public String getAttachmentUrlPath(Attachment attachment)
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 callAttachment.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 classContentEntityObject
- 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()
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 theContentEntityObject
the drafts points to if it exists and the draft itself otherwise.- Specified by:
getLatestVersion
in interfaceVersioned
- Overrides:
getLatestVersion
in classAbstractVersionedEntityObject
- Returns:
- the current version of this object.
- See Also:
ContentEntityObject.DRAFT
-
setContentPropertiesFromDraft
@Deprecated public void setContentPropertiesFromDraft(Draft draft)
Deprecated.Initialises theContentProperties
of this AbstractPage by performing a deep clone of theDraft
object's properties.
-
getConfluenceRevision
public String getConfluenceRevision()
- Overrides:
getConfluenceRevision
in classAbstractVersionedEntityObject
-
-