public interface DraftManager
Modifier and Type | Method and Description |
---|---|
int |
countDrafts(String owner) |
Draft |
create(String username,
DraftService.DraftType draftType,
String spaceKey)
Creates a new persistent draft of the specified draft type in the space
for the user.
|
default Draft |
create(String username,
DraftService.DraftType draftType,
String spaceKey,
long parentPageId)
Creates a new persistent draft of the specified draft type in the space
for the user.
|
Draft |
findDraft(Long pageId,
String owner,
String type,
String spaceKey)
Finds the draft with the given page ID, owner and type.
|
List<Draft> |
findDraftsForUser(com.atlassian.user.User user)
Returns the drafts for the user provided or an empty list if the user has no drafts.
|
Draft |
getDraft(long draftId)
Finds the draft given a specific draft id.
|
Draft |
getOrCreate(String username,
String draftType,
String spaceKey)
Deprecated.
since 5.7. No replacement.
|
boolean |
isMergeRequired(Draft draft)
Returns true if the draft version of a page is different to the current version of a page, otherwise false.
|
MergeResult |
mergeContent(Draft draft)
Attempts the merge the changes done by this draft with the latest version of the content.
|
void |
removeAllDrafts()
Removes all drafts stored in the database
|
void |
removeDraft(Draft draft)
Removes the draft specified.
|
void |
removeDraftsForUser(String username)
Removes all drafts in the data store associated with the specified user.
|
void |
saveDraft(Draft draft)
Saves the provided draft to the data store.
|
void saveDraft(Draft draft)
The draft must have a page ID of "0" for drafts of new content, or the ID of an existing page or blog post.
IllegalArgumentException
- if the provided draft is null, has a null page ID, or no content with the draft's page ID
can be found.Draft findDraft(Long pageId, String owner, String type, String spaceKey)
pageId
- the ID of the content which the draft is forowner
- the user name of the user who created the drafttype
- the type of draft, which is usually the result of calling ContentEntityObject.getType()
spaceKey
- Space that the draft lives in.int countDrafts(String owner)
owner
- Draft getDraft(long draftId)
void removeDraft(Draft draft)
List<Draft> findDraftsForUser(com.atlassian.user.User user)
boolean isMergeRequired(Draft draft)
Always returns false for new content.
MergeResult mergeContent(Draft draft)
draft
- the draft whose changes to merge with the latest version of the content@Deprecated Draft getOrCreate(String username, String draftType, String spaceKey)
username
- name of user or null for anonymous usersdraftType
- the content type of the draft, e.g. Page.CONTENT_TYPE
spaceKey
- the space key of the contentvoid removeAllDrafts()
void removeDraftsForUser(String username)
Draft create(String username, DraftService.DraftType draftType, String spaceKey)
username
- - the owner of the draft, may be null for anonymousdraftType
- - the type of draft, (either blogpost or page)spaceKey
- - the space in which to create the draftdefault Draft create(String username, DraftService.DraftType draftType, String spaceKey, long parentPageId)
username
- - the owner of the draft, may be null for anonymousdraftType
- - the type of draft, (either blogpost or page)spaceKey
- - the space in which to create the draftparentPageId
- - the parentPageId of a pageCopyright © 2003–2023 Atlassian. All rights reserved.