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.DRAFT
to see how new drafts are defined.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE
static String
LEGACY_DRAFT_PARENT_ID_KEY
The content ID of a new piece of content, as a String.static String
NEW
-
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 Draft()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object o)
ContentId
getContentId()
Returns theContentId
for this Draft.String
getContentSummary()
Deprecated.since 5.9 UseContentEntityObject.getExcerpt()
String
getDraftSpaceKey()
String
getDraftType()
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.String
getPageId()
Gets the id of theAbstractPage
which this is a draft of, as a String.Long
getPageIdAsLong()
int
getPageVersion()
String
getShareId()
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.String
getUrlPath()
int
hashCode()
boolean
isAuthor(com.atlassian.user.User user)
Deprecated.boolean
isBlank()
boolean
isDraft()
boolean
isIndexable()
Content entity objects that are historical versions should not be indexed.boolean
isNewPage()
Returns true if the draft is for a new piece of content, otherwise false.boolean
isUnpublished()
void
setDraftSpaceKey(String draftSpaceKey)
void
setDraftType(String draftType)
void
setPageId(Long pageId)
void
setPageId(String pageId)
void
setPageVersion(int pageVersion)
boolean
sharedAccessAllowed(com.atlassian.user.User user)
Checks if this draft can be accessed by users other than the creator (shared access)boolean
sharedAccessAllowed(String shareId)
Deprecated.since 5.10String
toString()
-
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:
isDraft
in 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:
sharedAccessAllowed
in 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:
sharedAccessAllowed
in 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:
getShareId
in classContentEntityObject
- See Also:
ContentEntityObject.SHARE_ID
-
isUnpublished
public boolean isUnpublished()
- Overrides:
isUnpublished
in 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:ContentEntityObject
Content entity objects that are historical versions should not be indexed.- Specified by:
isIndexable
in interfaceSearchable
- Overrides:
isIndexable
in 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:
getUrlPath
in interfaceAddressable
- Specified by:
getUrlPath
in classContentEntityObject
-
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 classContentEntityObject
-
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 interfaceContentTypeAware
- Specified by:
getType
in 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 theAbstractPage
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 theContentId
for this Draft.- Overrides:
getContentId
in classContentEntityObject
- Returns:
- the ContentId representation of this Draft's id
-
toString
public String toString()
- Overrides:
toString
in classContentEntityObject
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classContentEntityObject
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classContentEntityObject
-
-