|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.pages.DefaultDraftManager
public class DefaultDraftManager
This implementation supports anonymous drafts using session-based storage.
Field Summary | |
---|---|
protected org.apache.log4j.Logger |
log
Deprecated. |
Constructor Summary | |
---|---|
DefaultDraftManager()
|
Method Summary | |
---|---|
int |
countDrafts(java.lang.String owner)
|
Draft |
create(java.lang.String username,
DraftService.DraftType draftType,
java.lang.String spaceKey)
Creates a new persistent draft of the specified draft type in the space for the user. |
Draft |
createDraftForPage(AbstractPage page,
java.lang.String username)
Gets a new draft object. |
Draft |
findDraft(java.lang.Long pageId,
java.lang.String owner,
java.lang.String type,
java.lang.String spaceKey)
Finds the draft with the given page ID, owner and type. |
Draft |
findDraft(java.lang.String pageId,
java.lang.String owner,
java.lang.String type,
java.lang.String spaceKey)
Deprecated. |
java.util.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. |
int |
getDraftSaveInterval()
Returns the time in milliseconds between saving drafts in the editor. |
java.util.List<Draft> |
getDraftsForSpace(java.lang.String spaceKey)
|
java.lang.String |
getMergedContent(Draft draft)
Deprecated. since 4.0 use the MergeResult mergeContent(Draft draft) instead. |
Draft |
getOrCreate(java.lang.String username,
java.lang.String draftType,
java.lang.String spaceKey)
Gets a new draft object. |
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 |
removeAll()
Removes all drafts in the data store associated with the current user. |
void |
removeDraft(Draft draft)
Removes the draft specified by the given page ID, owner and type. |
void |
removeDraft(java.lang.String pageId,
java.lang.String owner,
java.lang.String type,
java.lang.String spaceKey)
Deprecated. |
void |
removeDraftById(long id)
Removes a draft by ID. |
void |
removeDraftsForUser(java.lang.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 |
setMergerManager(MergerManager mergerManager)
|
void |
setPageManager(PageManager pageManager)
|
void |
setSettingsManager(SettingsManager settingsManager)
|
void |
updateSpaceKey(java.lang.String newSpaceKey,
java.lang.String oldSpaceKey)
Updates all drafts with oldSpaceKey as their space key to have newSpaceKey instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated protected final transient org.apache.log4j.Logger log
Constructor Detail |
---|
public DefaultDraftManager()
Method Detail |
---|
public void saveDraft(Draft draft)
DraftManager
saveDraft
in interface DraftManager
public Draft findDraft(java.lang.Long pageId, java.lang.String owner, java.lang.String type, java.lang.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(java.lang.String owner)
countDrafts
in interface DraftManager
public Draft getDraft(long draftId)
DraftManager
getDraft
in interface DraftManager
public java.util.List<Draft> getDraftsForSpace(java.lang.String spaceKey)
getDraftsForSpace
in interface DraftManager
public void removeDraft(Draft draft)
DraftManager
removeDraft
in interface DraftManager
for an explanation of the arguments
,
for a faster way to remove a draft if you have its ID
public void removeDraftById(long id)
DraftManager
removeDraftById
in interface DraftManager
id
- the ID of the draft to removepublic int getDraftSaveInterval()
DraftManager
getDraftSaveInterval
in interface DraftManager
public java.util.List<Draft> findDraftsForUser(com.atlassian.user.User user)
DraftManager
findDraftsForUser
in interface DraftManager
public boolean isMergeRequired(Draft draft)
DraftManager
isMergeRequired
in interface DraftManager
@Deprecated public java.lang.String getMergedContent(Draft draft)
getMergedContent
in interface DraftManager
draft
- the draft whose changes to merge with the latest version of the content
public MergeResult mergeContent(Draft draft)
mergeContent
in interface DraftManager
draft
- the draft whose changes to merge with the latest version of the content
public void updateSpaceKey(java.lang.String newSpaceKey, java.lang.String oldSpaceKey)
DraftManager
updateSpaceKey
in interface DraftManager
newSpaceKey
- the new space keyoldSpaceKey
- the old space keypublic Draft create(java.lang.String username, DraftService.DraftType draftType, java.lang.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 draft
public Draft getOrCreate(java.lang.String username, java.lang.String draftType, java.lang.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 content
public Draft createDraftForPage(AbstractPage page, java.lang.String username)
DraftManager
createDraftForPage
in interface DraftManager
page
- the existing content to create the draft forusername
- name of user or null for anonymous users
public void removeAll()
DraftManager
removeAll
in interface DraftManager
public void removeDraftsForUser(java.lang.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 setHttpContext(HttpContext httpContext)
public void setMergerManager(MergerManager mergerManager)
@Deprecated public void removeDraft(java.lang.String pageId, java.lang.String owner, java.lang.String type, java.lang.String spaceKey)
DraftManager
removeDraft
in interface DraftManager
for an explanation of the arguments
,
for a faster way to remove a draft if you have its ID
@Deprecated public Draft findDraft(java.lang.String pageId, java.lang.String owner, java.lang.String type, java.lang.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |