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(java.lang.String creatorName)
           
 java.util.List<Draft> findAll()
          Returns all drafts stored in the data store.
 java.util.List<Draft> findByCreatorName(java.lang.String creatorName)
          Returns the drafts stored against the given username.
 java.util.List<Draft> getAllDraftsForSpace(java.lang.String spaceKey)
           
 Draft getDraft(long draftId)
          Returns the draft with the given ID, or null if no draft is found with that ID.
 Draft getDraft(java.lang.Long pageId, java.lang.String owner, java.lang.String type, java.lang.String spaceKey)
          Deprecated. since 5.2. User getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.
 Draft getDraft(java.lang.String pageId, ConfluenceUser owner, java.lang.String type, java.lang.String spaceKey)
          Finds and returns a draft object with all the specified properties or null if none is found.
 Draft getDraft(java.lang.String pageId, java.lang.String owner, java.lang.String type, java.lang.String spaceKey)
          Deprecated. since 5.2. User 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)
          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(java.lang.String newSpaceKey, java.lang.String oldSpaceKey)
          Changes all drafts with a space key of oldSpaceKey to have newSpaceKey.
 

Method Detail

saveOrUpdate

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

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

getDraft

Draft getDraft(java.lang.String pageId,
               ConfluenceUser owner,
               java.lang.String type,
               java.lang.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(java.lang.String pageId,
                          java.lang.String owner,
                          java.lang.String type,
                          java.lang.String spaceKey)
Deprecated. since 5.2. User getDraft(String, com.atlassian.confluence.user.ConfluenceUser, String, String) instead.


getDraft

@Deprecated
Draft getDraft(java.lang.Long pageId,
                          java.lang.String owner,
                          java.lang.String type,
                          java.lang.String spaceKey)
Deprecated. since 5.2. User 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.

See Also:
for a faster way to remove a draft when you know its ID

remove

void remove(long id)
Remove a draft based on its ID. Does nothing if such a draft is not found in the data store.


findByCreatorName

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


updateSpaceKey

void updateSpaceKey(java.lang.String newSpaceKey,
                    java.lang.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

removeAll

void removeAll()
Removes all drafts in the data store.


findAll

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


getAllDraftsForSpace

java.util.List<Draft> getAllDraftsForSpace(java.lang.String spaceKey)
Parameters:
spaceKey -
Returns:
all the drafts in the space identified.

countDrafts

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


Copyright © 2003-2014 Atlassian. All Rights Reserved.