Package com.atlassian.confluence.pages
Class DefaultDraftManager
java.lang.Object
com.atlassian.confluence.pages.DefaultDraftManager
- All Implemented Interfaces:
DraftManager
This implementation supports anonymous drafts using session-based storage.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountDrafts(String owner) create(String username, DraftService.DraftType draftType, String spaceKey) Creates a new persistent draft of the specified draft type in the space for the user.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.Finds the draft with the given page ID, owner and type.findDraftsForUser(com.atlassian.user.User user) Returns the drafts for the user provided or an empty list if the user has no drafts.getDraft(long draftId) Finds the draft given a specific draft id.getOrCreate(String username, String draftType, String spaceKey) Deprecated.booleanisMergeRequired(Draft draft) Returns true if the draft version of a page is different to the current version of a page, otherwise false.mergeContent(Draft draft) Merges the draft with the original version compared to the latest version of the page.voidRemoves all drafts stored in the databasevoidremoveDraft(Draft draft) Removes the draft specified.voidremoveDraftsForUser(String username) Removes all drafts in the data store associated with the specified user.voidSaves the provided draft to the data store.voidsetAttachmentManager(AttachmentManager attachmentManager) voidsetConfluenceUserDao(ConfluenceUserDao confluenceUserDao) voidsetDraftDao(DraftDao draftDao) voidsetHttpContext(HttpContext httpContext) voidsetLabelManager(LabelManager labelManager) voidsetMergerManager(MergerManager mergerManager) voidsetPageManager(PageManager pageManager) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.pages.DraftManager
countDrafts, create, create, findDraft, findDraftsForUser, removeDraftsForUser
-
Constructor Details
-
DefaultDraftManager
public DefaultDraftManager()
-
-
Method Details
-
saveDraft
Description copied from interface:DraftManagerSaves the provided draft to the data store. Anonymous drafts will be persisted to the web session.The draft must have a page ID of "0" for drafts of new content, or the ID of an existing page or blog post.
- Specified by:
saveDraftin interfaceDraftManager
-
findDraft
Description copied from interface:DraftManagerFinds the draft with the given page ID, owner and type. Returns null if a matching draft cannot be found.- Specified by:
findDraftin interfaceDraftManager- Parameters:
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 callingContentEntityObject.getType()spaceKey- Space that the draft lives in.- Returns:
- the matching draft or null if a draft cannot be found
-
countDrafts
- Specified by:
countDraftsin interfaceDraftManager- Returns:
- A count of drafts with content for the given owner
-
getDraft
Description copied from interface:DraftManagerFinds the draft given a specific draft id. Returns null if no draft is found.- Specified by:
getDraftin interfaceDraftManager- Returns:
- the matching draft or null if a draft cannot be found
-
removeDraft
Description copied from interface:DraftManagerRemoves the draft specified. Does nothing if the draft cannot be found.- Specified by:
removeDraftin interfaceDraftManager
-
findDraftsForUser
Description copied from interface:DraftManagerReturns the drafts for the user provided or an empty list if the user has no drafts.- Specified by:
findDraftsForUserin interfaceDraftManager
-
isMergeRequired
Description copied from interface:DraftManagerReturns true if the draft version of a page is different to the current version of a page, otherwise false.Always returns false for new content.
- Specified by:
isMergeRequiredin interfaceDraftManager
-
mergeContent
Merges the draft with the original version compared to the latest version of the page.- Specified by:
mergeContentin interfaceDraftManager- Parameters:
draft- the draft whose changes to merge with the latest version of the content- Returns:
- result of the merge which contains additional information about the merge.
-
create
Description copied from interface:DraftManagerCreates a new persistent draft of the specified draft type in the space for the user.- Specified by:
createin interfaceDraftManager- Parameters:
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 draft- Returns:
- a newly created persistent draft
-
create
public Draft create(String username, DraftService.DraftType draftType, String spaceKey, long parentPageId) Description copied from interface:DraftManagerCreates a new persistent draft of the specified draft type in the space for the user.- Specified by:
createin interfaceDraftManager- Parameters:
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- Returns:
- a newly created persistent draft
-
getOrCreate
Deprecated.Description copied from interface:DraftManagerGets a new draft object. If such a draft does not exist one is created.- Specified by:
getOrCreatein interfaceDraftManager- Parameters:
username- name of user or null for anonymous usersdraftType- the content type of the draft, e.g.Page.CONTENT_TYPEspaceKey- the space key of the content- Returns:
- the existing draft for the given content and user, or a new draft object if that does not exist.
-
removeAllDrafts
public void removeAllDrafts()Description copied from interface:DraftManagerRemoves all drafts stored in the database- Specified by:
removeAllDraftsin interfaceDraftManager
-
removeDraftsForUser
Description copied from interface:DraftManagerRemoves all drafts in the data store associated with the specified user.- Specified by:
removeDraftsForUserin interfaceDraftManager
-
setDraftDao
-
setPageManager
-
setAttachmentManager
-
setLabelManager
-
setHttpContext
-
setMergerManager
-
setConfluenceUserDao
-