public interface DraftService
Modifier and Type | Interface and Description |
---|---|
static class |
DraftService.DraftType |
Modifier and Type | Method and Description |
---|---|
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)
|
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.
@since 4.3 use
removeDraft(long) |
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.
|
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
draftId
- title
- type
- content
- the editor formatted content (will be converted into storage format).contentId
- as a String since NEW is taken to represent a new draftspaceKey
- pageVersion
- 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 existjava.lang.IllegalArgumentException
- if there is a problem with the arguments supplied@Deprecated 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(Long, String, DraftType, String, Long, String, int)
Draft createDraftForEditor(AbstractPage page) throws NotAuthorizedException, NotValidException
page
- the page to create a Draft fromNotAuthorizedException
- 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 existboolean isDraftContentChanged(java.lang.Long draftId, java.lang.String title, java.lang.String content, java.lang.Long contentId)
Draft.isBlank()
returns false and the draft has no attachmentsDraft findDraftForEditor(long contentId, DraftService.DraftType type, java.lang.String spaceKey) throws NotAuthorizedException, NotValidException
contentId
- type
- spaceKey
- NotAuthorizedException
- if the current user is not permitted to view drafts for the identified contentNotValidException
- if the content identified does not existjava.lang.IllegalArgumentException
- if there are any problems with the supplied parametersDraft findOrCreateDraftForEditor(java.lang.String spaceKey, DraftService.DraftType type) throws NotAuthorizedException, NotValidException
findDraftForEditor(long, com.atlassian.confluence.content.service.DraftService.DraftType, java.lang.String)
or createNewContentDraft(java.lang.String, com.atlassian.confluence.content.service.DraftService.DraftType)
or getDraft(long)
instead.NotAuthorizedException
- if the current user is not permitted to view or create drafts in the spaceNotValidException
- if the space identified does not exist.java.lang.IllegalArgumentException
- if the required parameters are not provided.Draft createNewContentDraft(java.lang.String spaceKey, DraftService.DraftType type) throws NotAuthorizedException, NotValidException
java.lang.Long removeDraft(long abstractPageId, long draftId) throws NotAuthorizedException, NotValidException
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
@Deprecated void removeDraft(long contentId, DraftService.DraftType type, java.lang.String spaceKey) throws NotAuthorizedException, NotValidException
removeDraft(long)
contentId
- type
- spaceKey
- since a new page draft is unique per space the spaceKey must be provided if the contentId is 0NotAuthorizedException
- if the current user does not have permission.NotValidException
java.lang.Long removeDraft(long draftId)
draftId
- a draft to removejava.util.List<Draft> findDrafts(int limit, int offset) throws NotAuthorizedException, NotValidException
limit
- - the maximum number of drafts to returnoffset
- - the offset of resultsNotAuthorizedException
NotValidException
int countDrafts()
Draft getDraft(long draftId) throws NotAuthorizedException, NotValidException
draftId
- NotAuthorizedException
- - if the owner of the draft is not the authenticated userNotValidException
- - if no draft exists with this idCopyright © 2003-2014 Atlassian. All Rights Reserved.