public interface

DraftDao

com.atlassian.confluence.pages.persistence.dao.DraftDao
Known Indirect Subclasses

Class Overview

Stores Confluence drafts in a data store.

Summary

Public Methods
List<Draft> findAll()
Returns all drafts stored in the data store.
List<Draft> findByCreatorName(String creatorName)
Returns the drafts stored against the given username.
List<Draft> getAllDraftsForSpace(String spaceKey)
Draft getDraft(String pageId, String owner, String type, String spaceKey)
Finds and returns a draft object with all the specified properties or null if none is found.
Draft getDraft(long draftId)
Returns the draft with the given ID, or null if no draft is found with that ID.
void remove(Draft draft)
Removes a draft based on its page ID, owner and type.
void remove(long id)
Remove a draft based on its ID.
void removeAll()
Removes all drafts in the data store.
void saveOrUpdate(Draft draft)
Saves the draft.
void updateSpaceKey(String newSpaceKey, String oldSpaceKey)
Changes all drafts with a space key of oldSpaceKey to have newSpaceKey.

Public Methods

public List<Draft> findAll ()

Returns all drafts stored in the data store.

public List<Draft> findByCreatorName (String creatorName)

Returns the drafts stored against the given username.

public List<Draft> getAllDraftsForSpace (String spaceKey)

Returns
  • all the drafts in the space identified.

public Draft getDraft (String pageId, String owner, String type, String spaceKey)

Finds and returns a draft object with all the specified properties or null if none is found.

Parameters
pageId the id of the page which this draft is associated with
owner the owner of the draft
type the type of draft, which is usually the result of calling getType()
spaceKey space key, if relevant for the draft. This is used to enable NEW page drafts across multiple spaces
Returns
  • a draft object with all the specified properties or null if no valid draft could be found

public Draft getDraft (long draftId)

Returns the draft with the given ID, or null if no draft is found with that ID.

public void remove (Draft draft)

Removes a draft based on its page ID, owner and type. Does nothing if such a draft is not found in the data store.

public void remove (long id)

Remove a draft based on its ID. Does nothing if such a draft is not found in the data store.

public void removeAll ()

Removes all drafts in the data store.

public void saveOrUpdate (Draft draft)

Saves the draft.

Throws
IllegalArgumentException if the draft has no page ID, owner or type.

public void updateSpaceKey (String newSpaceKey, String oldSpaceKey)

Changes all drafts with a space key of oldSpaceKey to have newSpaceKey.

Parameters
newSpaceKey the new space key
oldSpaceKey the old space key