Package com.atlassian.confluence.pages
Class Draft
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- 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.DRAFTto see how new drafts are defined.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_TYPEstatic StringLEGACY_DRAFT_PARENT_ID_KEYThe content ID of a new piece of content, as a String.static StringNEW-
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, DELETED_BY, DELETED_BY_ANON_VALUE, 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 Draft()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object o)ContentIdgetContentId()Returns theContentIdfor this Draft.StringgetContentSummary()Deprecated.since 5.9 UseContentEntityObject.getExcerpt()StringgetDraftSpaceKey()StringgetDraftType()StringgetNameForComparison()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.StringgetPageId()Gets the id of theAbstractPagewhich this is a draft of, as a String.LonggetPageIdAsLong()intgetPageVersion()StringgetShareId()StringgetType()An easy name for the type of this content: makes it easy for things like the #contentLink macro to work out what to draw.StringgetUrlPath()inthashCode()booleanisAuthor(com.atlassian.user.User user)Deprecated.booleanisBlank()booleanisDraft()booleanisIndexable()Content entity objects that are historical versions should not be indexed.booleanisNewPage()Returns true if the draft is for a new piece of content, otherwise false.booleanisUnpublished()voidsetDraftSpaceKey(String draftSpaceKey)voidsetDraftType(String draftType)voidsetPageId(Long pageId)voidsetPageId(String pageId)voidsetPageVersion(int pageVersion)booleansharedAccessAllowed(com.atlassian.user.User user)Checks if this draft can be accessed by users other than the creator (shared access)booleansharedAccessAllowed(String shareId)Deprecated.since 5.10StringtoString()-
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, applyChildVersioningPolicy, applyChildVersioningPolicy, clone, compareTo, convertToHistoricalVersion, ensureAttachmentBelongsToContent, getAttachmentManager, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getAttachmentUrlPath, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getCollaborativeEditingUuid, getComments, getContainerContent, getContentPermission, getContentPermissionSet, getContentStatus, getContentStatusObject, getCustomContent, getDefaultBodyType, getDisplayTitle, getEntity, getExcerpt, getIdAsString, getLatestVersionId, getLatestVersionsOfAttachments, getLowerTitle, getOriginalVersionId, getOutgoingLinks, getPermissions, getProperties, getRenderedVersionComment, getSearchableDependants, getSelector, getSynchronyRevision, getSynchronyRevisionSource, getTitle, getTrashDate, getTypeEnum, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeCustomContent, removeOutgoingLink, replaceContentProperties, restore, restoreDependents, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setCollaborativeEditingUuid, setComments, setContainerContent, setContentPropertiesFrom, setContentStatus, setOriginalVersion, setOriginalVersionId, setOutgoingLinks, setShareId, setSynchronyRevision, setSynchronyRevisionSource, setTitle, setVersionComment, toPageContext, 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
getConfluenceRevision, getLatestVersion, 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.bonnie.Searchable
getId
-
-
-
-
Field Detail
-
LEGACY_DRAFT_PARENT_ID_KEY
public static final String LEGACY_DRAFT_PARENT_ID_KEY
The content ID of a new piece of content, as a String.- See Also:
- Constant Field Values
-
NEW
public static final String NEW
-
CONTENT_TYPE
public static final String CONTENT_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDraft
public boolean isDraft()
- Overrides:
isDraftin classContentEntityObject
-
sharedAccessAllowed
@Deprecated public boolean sharedAccessAllowed(String shareId)
Deprecated.since 5.10Checks 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:
sharedAccessAllowedin classContentEntityObject- 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:
TODO: delete this method after 6.0
-
sharedAccessAllowed
public boolean sharedAccessAllowed(com.atlassian.user.User user)
Checks if this draft can be accessed by users other than the creator (shared access)All legacy drafts are private
- Overrides:
sharedAccessAllowedin classContentEntityObject- Parameters:
user- User to check access for- Returns:
- true if this draft can be accessed by the user, false otherwise
- See Also:
ContentEntityObject.sharedAccessAllowed(User)
-
getShareId
public String getShareId()
- Overrides:
getShareIdin classContentEntityObject- See Also:
ContentEntityObject.SHARE_ID
-
isUnpublished
public boolean isUnpublished()
- Overrides:
isUnpublishedin classContentEntityObject
-
getContentSummary
@Deprecated public String getContentSummary()
Deprecated.since 5.9 UseContentEntityObject.getExcerpt()
-
isAuthor
@Deprecated public boolean isAuthor(com.atlassian.user.User user)
Deprecated.
-
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:ContentEntityObjectContent entity objects that are historical versions should not be indexed.- Specified by:
isIndexablein interfaceSearchable- Overrides:
isIndexablein classContentEntityObject
-
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:
getUrlPathin interfaceAddressable- Specified by:
getUrlPathin classContentEntityObject
-
getNameForComparison
public String getNameForComparison()
Description copied from class:ContentEntityObjectSubclasses 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:
getNameForComparisonin classContentEntityObject
-
getType
public String getType()
Description copied from class:ContentEntityObjectAn 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:
getTypein interfaceContentTypeAware- Specified by:
getTypein classContentEntityObject- 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 theAbstractPagewhich 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 theContentIdfor this Draft.- Overrides:
getContentIdin classContentEntityObject- Returns:
- the ContentId representation of this Draft's id
-
toString
public String toString()
- Overrides:
toStringin classContentEntityObject
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classContentEntityObject
-
hashCode
public int hashCode()
- Overrides:
hashCodein classContentEntityObject
-
-