Interface DraftService

  • All Known Implementing Classes:

    public interface DraftService
    A Service responsible for Draft related operations during editing in Confluence.

    This service will only support the handling of Draft (legacy drafts)

    • Method Detail

      • saveDraftFromEditor

        default Draft saveDraftFromEditor​(Long draftId,
                                          Long parentPageId,
                                          String title,
                                          DraftService.DraftType type,
                                          String content,
                                          Long contentId,
                                          String spaceKey,
                                          int pageVersion)
                                   throws NotValidException
        Create and store a draft for the current user with the supplied details.
        draftId -
        parentPageId -
        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 draft
        spaceKey -
        pageVersion -
        The Draft model object that was created and saved. The content of this draft will be in storage format
        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
        IllegalArgumentException - if there is a problem with the arguments supplied
      • isDraftContentChanged

        boolean isDraftContentChanged​(Long draftId,
                                      String title,
                                      String content,
                                      Long contentId)
        since 5.7. No replacement (should stop being used).
        Compares the content of a draft to an existing page. If the draft is for a new page returns true when Draft.isBlank() returns false and the draft has no attachments
        true if the draft content is different to it's pages content, or not blank when a new draft.
      • removeDraft

        Long removeDraft​(long abstractPageId,
                         long draftId)
        Removes the draft specified by the given page id or draft id for the current user. Looks at the draftId by preference, and reverts to the abstractPageId if the draftId is 0. Throws IllegalStateException if the draftId is 0 and the abstract page cannot be found.
        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.
        the id of the removed draft or null if neither a matching page nor draft could be found.
        NotAuthorizedException - if the current user does not have permission.
      • removeDraft

        Long removeDraft​(long draftId)
        Removes the draft with the specified ID if it is found, and returns the same ID passed.
        draftId - a draft to remove
        draftId removed or null.