|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.content.service.DefaultDraftService
public class DefaultDraftService
Note that this implementation of the DraftService does not perform any permission checking. This has always been the case in Confluence and needs to remain the case at the moment due to the way certain UI operations work such as copying a page. See CONFDEV-227 for more details.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.service.DraftService |
---|
DraftService.DraftType |
Method Summary | |
---|---|
int |
countDrafts()
|
Draft |
createDraftForEditor(AbstractPage page)
Create and store a draft for the supplied AbstractPage for the current user. |
Draft |
createNewContentDraft(java.lang.String spaceKey,
DraftService.DraftType type)
|
Draft |
findDraftForEditor(long contentId,
DraftService.DraftType type,
java.lang.String spaceKey)
Find and return a draft of the specified content Id and type for the current user. |
java.util.List<Draft> |
findDrafts(int limit,
int offset)
Finds the users drafts. |
Draft |
findOrCreateDraftForEditor(java.lang.String spaceKey,
DraftService.DraftType type)
Create the draft within the identified space for the current user. |
Draft |
getDraft(long draftId)
gets the draft by id for the authenticated user |
boolean |
isDraftContentChanged(java.lang.Long draftId,
java.lang.String title,
java.lang.String content,
java.lang.Long contentId)
Compares the content of a draft to an existing page. |
java.lang.Long |
removeDraft(long draftId)
Removes the draft with the specified ID if it is found, and returns the same ID passed. |
void |
removeDraft(long contentId,
DraftService.DraftType type,
java.lang.String spaceKey)
Deprecated. |
java.lang.Long |
removeDraft(long abstractPageId,
long draftId)
Removes the draft specified by the given page id or draft id for the current user. |
Draft |
saveDraftFromEditor(java.lang.Long draftId,
java.lang.String title,
DraftService.DraftType type,
java.lang.String content,
java.lang.Long contentId,
java.lang.String spaceKey,
int pageVersion)
Create and store a draft for the current user with the supplied details. |
Draft |
saveDraftFromEditor(java.lang.String title,
DraftService.DraftType type,
java.lang.String content,
java.lang.String contentId,
java.lang.String spaceKey,
int pageVersion)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Draft saveDraftFromEditor(java.lang.Long draftId, java.lang.String title, DraftService.DraftType type, java.lang.String content, java.lang.Long contentId, java.lang.String spaceKey, int pageVersion) throws NotAuthorizedException, NotValidException
DraftService
saveDraftFromEditor
in interface DraftService
content
- the editor formatted content (will be converted into storage format).contentId
- as a String since NEW is taken to represent a new draft
NotAuthorizedException
- if the current user is not able to save a draft (doesn't have edit permission)
NotValidException
- if the data for the draft is incomplete or the content identified does not exist@Deprecated public Draft saveDraftFromEditor(java.lang.String title, DraftService.DraftType type, java.lang.String content, java.lang.String contentId, java.lang.String spaceKey, int pageVersion) throws NotAuthorizedException, NotValidException
saveDraftFromEditor
in interface DraftService
NotAuthorizedException
NotValidException
public Draft findDraftForEditor(long contentId, DraftService.DraftType type, java.lang.String spaceKey) throws NotAuthorizedException, NotValidException
DraftService
findDraftForEditor
in interface DraftService
NotAuthorizedException
- if the current user is not permitted to view drafts for the identified content
NotValidException
- if the content identified does not existpublic Draft createDraftForEditor(AbstractPage page) throws NotAuthorizedException, NotValidException
DraftService
createDraftForEditor
in interface DraftService
page
- the page to create a Draft from
NotAuthorizedException
- if the current user is not able to save a draft (doesn't have edit permission)
NotValidException
- if the data for the draft is incomplete or the content identified does not existpublic Draft findOrCreateDraftForEditor(java.lang.String spaceKey, DraftService.DraftType type) throws NotAuthorizedException, NotValidException
DraftService
findOrCreateDraftForEditor
in interface DraftService
NotAuthorizedException
- if the current user is not permitted to view or create drafts in the space
NotValidException
- if the space identified does not exist.public Draft createNewContentDraft(java.lang.String spaceKey, DraftService.DraftType type) throws NotAuthorizedException, NotValidException
createNewContentDraft
in interface DraftService
NotAuthorizedException
NotValidException
public java.lang.Long removeDraft(long abstractPageId, long draftId) throws NotAuthorizedException, NotValidException
DraftService
removeDraft
in interface DraftService
abstractPageId
- the id of the abstract page the draft is an edit for.draftId
- the draft of the id to remove, this is necessary if abstractPageId = 0.
NotAuthorizedException
- if the current user does not have permission.
NotValidException
public java.lang.Long removeDraft(long draftId) throws NotAuthorizedException, NotValidException
DraftService
removeDraft
in interface DraftService
draftId
- a draft to remove
NotAuthorizedException
NotValidException
public java.util.List<Draft> findDrafts(int limit, int offset) throws NotAuthorizedException, NotValidException
DraftService
findDrafts
in interface DraftService
limit
- - the maximum number of drafts to returnoffset
- - the offset of results
NotAuthorizedException
NotValidException
public int countDrafts()
countDrafts
in interface DraftService
public Draft getDraft(long draftId) throws NotAuthorizedException, NotValidException
DraftService
getDraft
in interface DraftService
NotAuthorizedException
- - if the owner of the draft is not the authenticated user
NotValidException
- - if no draft exists with this id@Deprecated public void removeDraft(long contentId, DraftService.DraftType type, java.lang.String spaceKey) throws NotAuthorizedException, NotValidException
DraftService
removeDraft
in interface DraftService
spaceKey
- since a new page draft is unique per space the spaceKey must be provided if the contentId is 0
NotAuthorizedException
- if the current user does not have permission.
NotValidException
public boolean isDraftContentChanged(java.lang.Long draftId, java.lang.String title, java.lang.String content, java.lang.Long contentId) throws NotAuthorizedException, NotValidException
DraftService
Draft.isBlank()
returns false and the draft has no attachments
isDraftContentChanged
in interface DraftService
NotAuthorizedException
NotValidException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |