com.atlassian.confluence.pages
Class Draft

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.pages.Draft
All Implemented Interfaces:
com.atlassian.bonnie.Searchable, Content, Addressable, ContentTypeAware, Versioned, EditableLabelable, Labelable, Serializable, Cloneable, Comparable

public class Draft
extends ContentEntityObject

See Also:
Serialized Form

Field Summary
static String CONTENT_TYPE
           
static String NEW
          The content ID of a new piece of content, as a String.
static Long NEW_CONTENT_ID
          This is the placeholder id used in Drafts for new content.
static String SHARE_ID
           
 
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
Draft()
           
 
Method Summary
 boolean equals(Object o)
           
 String getContentSummary()
           
 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 the AbstractPage which this is a draft of, as a String.
 Long getPageIdAsLong()
           
 int getPageVersion()
           
 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)
           
 boolean isBlank()
           
 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.
 void setDraftSpaceKey(String draftSpaceKey)
           
 void setDraftType(String draftType)
           
 void setPageId(Long pageId)
           
 void setPageId(String pageId)
           
 void setPageVersion(int pageVersion)
           
 String toString()
           
 
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addCustomContent, addOutgoingLink, addPermission, addReferralLink, addTrackbackLink, applyChildVersioningPolicy, clone, compareTo, convertToHistoricalVersion, ensureAttachmentBelongsToContent, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getAttachmentUrlPath, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getComments, getContainerContent, getContentEntityObject, getContentId, getContentPermission, getContentPermissionSet, getContentStatus, getDefaultBodyType, getDisplayTitle, getEntity, getExcerpt, getIdAsString, getLatestVersionsOfAttachments, getOutgoingLinks, getPermissions, getProperties, getReferralLinks, getRenderedVersionComment, getSearchableDependants, 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, setTitle, setTrackbackLinks, setUserAccessor, setVersionComment, toPageContext, trash, 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
getLatestVersion, 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

SHARE_ID

@ExperimentalApi
public static final String SHARE_ID
See Also:
Constant Field Values

NEW_CONTENT_ID

public static final Long NEW_CONTENT_ID
This is the placeholder id used in Drafts for new content. There's also a string form: NEW.


NEW

public static final String NEW
The content ID of a new piece of content, as a String. There's also a Long form: NEW_CONTENT_ID.

See Also:
Constant Field Values

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

Draft

public Draft()
Method Detail

getContentSummary

public String getContentSummary()

isAuthor

public boolean isAuthor(com.atlassian.user.User user)

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 interface com.atlassian.bonnie.Searchable
Overrides:
isIndexable in class ContentEntityObject

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 interface Addressable
Specified by:
getUrlPath in class ContentEntityObject

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 class ContentEntityObject

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

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 the AbstractPage 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)

toString

public String toString()
Overrides:
toString in class ContentEntityObject

equals

public boolean equals(Object o)
Overrides:
equals in class ContentEntityObject

hashCode

public int hashCode()
Overrides:
hashCode in class ContentEntityObject


Copyright © 2003–2015 Atlassian. All rights reserved.