com.atlassian.confluence.pages.persistence.dao
Interface DraftDao

All Known Implementing Classes:
HibernateDraftDao, SessionDraftDao

public interface DraftDao

Stores Confluence drafts in a data store.


Method Summary
 int countDrafts(String creatorName)
           
 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)
          Deprecated. since 5.7. No replacement.
 Draft getDraft(long draftId)
          Returns the draft with the given ID, or null if no draft is found with that ID.
 Draft getDraft(Long pageId, String owner, String type, String spaceKey)
          Deprecated. since 5.2. Use getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.
 Draft getDraft(String pageId, ConfluenceUser owner, String type, String spaceKey)
          Finds and returns a draft object with all the specified properties or null if none is found.
 Draft getDraft(String pageId, String owner, String type, String spaceKey)
          Deprecated. since 5.2. Use getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.
 void remove(Draft draft)
          Removes a draft based on its page ID, owner and type.
 void remove(long id)
          Deprecated. since 5.7. Use remove(Draft)
 void removeAll()
          Deprecated. since 5.7. No replacement.
 void saveOrUpdate(Draft draft)
          Saves the draft.
 void updateSpaceKey(String newSpaceKey, String oldSpaceKey)
          Deprecated. since 5.7. No replacement.
 

Method Detail

saveOrUpdate

void saveOrUpdate(Draft draft)
                  throws IllegalArgumentException
Saves the draft.

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

getDraft

Draft getDraft(String pageId,
               ConfluenceUser 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 ContentEntityObject.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
Since:
5.2

getDraft

@Deprecated
Draft getDraft(String pageId,
                          String owner,
                          String type,
                          String spaceKey)
Deprecated. since 5.2. Use getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.


getDraft

@Deprecated
Draft getDraft(Long pageId,
                          String owner,
                          String type,
                          String spaceKey)
Deprecated. since 5.2. Use getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.


getDraft

Draft getDraft(long draftId)
Returns the draft with the given ID, or null if no draft is found with that ID.


remove

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.


remove

@Deprecated
void remove(long id)
Deprecated. since 5.7. Use remove(Draft)

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


findByCreatorName

List<Draft> findByCreatorName(String creatorName)
Returns the drafts stored against the given username.


updateSpaceKey

@Deprecated
void updateSpaceKey(String newSpaceKey,
                               String oldSpaceKey)
Deprecated. since 5.7. No replacement.

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

Parameters:
newSpaceKey - the new space key
oldSpaceKey - the old space key

removeAll

@Deprecated
void removeAll()
Deprecated. since 5.7. No replacement.

Removes all drafts in the data store.


findAll

List<Draft> findAll()
Returns all drafts stored in the data store.


getAllDraftsForSpace

@Deprecated
List<Draft> getAllDraftsForSpace(String spaceKey)
Deprecated. since 5.7. No replacement.

Parameters:
spaceKey -
Returns:
all the drafts in the space identified.

countDrafts

int countDrafts(String creatorName)
Returns:
count of number of drafts for this daos owner


Copyright © 2003–2015 Atlassian. All rights reserved.