com.atlassian.confluence.pages.persistence.dao
Class SessionDraftDao

java.lang.Object
  extended by com.atlassian.confluence.pages.persistence.dao.SessionDraftDao
All Implemented Interfaces:
DraftDao

public class SessionDraftDao
extends java.lang.Object
implements DraftDao

Stores drafts in the session, primarily for anonymous users.


Constructor Summary
SessionDraftDao(javax.servlet.http.HttpSession session)
           
 
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. 
 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. 
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionDraftDao

public SessionDraftDao(javax.servlet.http.HttpSession session)
Method Detail

saveOrUpdate

public void saveOrUpdate(Draft draft)
Description copied from interface: DraftDao
Saves the draft.

Specified by:
saveOrUpdate in interface DraftDao

getDraft

public Draft getDraft(java.lang.String pageId,
                      ConfluenceUser owner,
                      java.lang.String type,
                      java.lang.String spaceKey)
Description copied from interface: DraftDao
Finds and returns a draft object with all the specified properties or null if none is found.

Specified by:
getDraft in interface DraftDao
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

getDraft

@Deprecated
public Draft getDraft(java.lang.String pageId,
                                 java.lang.String owner,
                                 java.lang.String type,
                                 java.lang.String spaceKey)
Deprecated. 

Specified by:
getDraft in interface DraftDao

getDraft

@Deprecated
public Draft getDraft(java.lang.Long pageId,
                                 java.lang.String owner,
                                 java.lang.String type,
                                 java.lang.String spaceKey)
Deprecated. 

Specified by:
getDraft in interface DraftDao

getDraft

public Draft getDraft(long draftId)
Description copied from interface: DraftDao
Returns the draft with the given ID, or null if no draft is found with that ID.

Specified by:
getDraft in interface DraftDao

remove

public void remove(Draft draft)
Description copied from interface: DraftDao
Removes a draft based on its page ID, owner and type. Does nothing if such a draft is not found in the data store.

Specified by:
remove in interface DraftDao
See Also:
for a faster way to remove a draft when you know its ID

remove

public void remove(long id)
Description copied from interface: DraftDao
Remove a draft based on its ID. Does nothing if such a draft is not found in the data store.

Specified by:
remove in interface DraftDao

findByCreatorName

public java.util.List<Draft> findByCreatorName(java.lang.String creatorName)
Description copied from interface: DraftDao
Returns the drafts stored against the given username.

Specified by:
findByCreatorName in interface DraftDao

updateSpaceKey

public void updateSpaceKey(java.lang.String newSpaceKey,
                           java.lang.String oldSpaceKey)
Description copied from interface: DraftDao
Changes all drafts with a space key of oldSpaceKey to have newSpaceKey.

Specified by:
updateSpaceKey in interface DraftDao
Parameters:
newSpaceKey - the new space key
oldSpaceKey - the old space key

removeAll

public void removeAll()
Description copied from interface: DraftDao
Removes all drafts in the data store.

Specified by:
removeAll in interface DraftDao

findAll

public java.util.List<Draft> findAll()
Description copied from interface: DraftDao
Returns all drafts stored in the data store.

Specified by:
findAll in interface DraftDao

getAllDraftsForSpace

public java.util.List<Draft> getAllDraftsForSpace(java.lang.String spaceKey)
Specified by:
getAllDraftsForSpace in interface DraftDao
Returns:
all the drafts in the space identified.

countDrafts

public int countDrafts(java.lang.String creatorName)
Specified by:
countDrafts in interface DraftDao
Returns:
count of number of drafts for this daos owner


Copyright © 2003-2014 Atlassian. All Rights Reserved.