public class DefaultDraftManager extends Object implements DraftManager
Constructor and Description |
---|
DefaultDraftManager() |
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.
|
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.
|
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)
Merges the draft with the original version compared to the latest version of the page.
|
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 |
setAttachmentManager(AttachmentManager attachmentManager) |
void |
setDraftDao(DraftDao draftDao) |
void |
setHttpContext(HttpContext httpContext) |
void |
setLabelManager(LabelManager labelManager) |
void |
setMergerManager(MergerManager mergerManager) |
void |
setPageManager(PageManager pageManager) |
void |
setSettingsManager(SettingsManager settingsManager) |
public void saveDraft(Draft draft)
DraftManager
The draft must have a page ID of "0" for drafts of new content, or the ID of an existing page or blog post.
saveDraft
in interface DraftManager
public Draft findDraft(Long pageId, String owner, String type, String spaceKey)
DraftManager
findDraft
in interface DraftManager
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.public int countDrafts(String owner)
countDrafts
in interface DraftManager
public Draft getDraft(long draftId)
DraftManager
getDraft
in interface DraftManager
public void removeDraft(Draft draft)
DraftManager
removeDraft
in interface DraftManager
public List<Draft> findDraftsForUser(com.atlassian.user.User user)
DraftManager
findDraftsForUser
in interface DraftManager
public boolean isMergeRequired(Draft draft)
DraftManager
Always returns false for new content.
isMergeRequired
in interface DraftManager
public MergeResult mergeContent(Draft draft)
mergeContent
in interface DraftManager
draft
- the draft whose changes to merge with the latest version of the contentpublic Draft create(String username, DraftService.DraftType draftType, String spaceKey)
DraftManager
create
in interface DraftManager
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 draftpublic Draft create(String username, DraftService.DraftType draftType, String spaceKey, long parentPageId)
DraftManager
create
in interface DraftManager
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 page@Deprecated public Draft getOrCreate(String username, String draftType, String spaceKey)
DraftManager
getOrCreate
in interface DraftManager
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 contentpublic void removeAllDrafts()
DraftManager
removeAllDrafts
in interface DraftManager
public void removeDraftsForUser(String username)
DraftManager
removeDraftsForUser
in interface DraftManager
public void setSettingsManager(SettingsManager settingsManager)
public void setDraftDao(DraftDao draftDao)
public void setPageManager(PageManager pageManager)
public void setAttachmentManager(AttachmentManager attachmentManager)
public void setLabelManager(LabelManager labelManager)
public void setHttpContext(HttpContext httpContext)
public void setMergerManager(MergerManager mergerManager)
Copyright © 2003–2020 Atlassian. All rights reserved.