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

public class SessionDraftDao extends Object implements DraftDao
Stores drafts in the session, primarily for anonymous users.
  • Constructor Details

    • SessionDraftDao

      public SessionDraftDao(jakarta.servlet.http.HttpSession session)
  • Method Details

    • saveOrUpdate

      public void saveOrUpdate(Draft draft)
      Description copied from interface: DraftDao
      Saves the draft.
      Specified by:
      saveOrUpdate in interface DraftDao
    • getDraft

      public Draft getDraft(String pageId, ConfluenceUser owner, String type, 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

      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
    • findByCreator

      public List<Draft> findByCreator(ConfluenceUser creator)
      Description copied from interface: DraftDao
      Returns the drafts stored against the given username.
      Specified by:
      findByCreator in interface DraftDao
    • findAll

      public List<Draft> findAll()
      Description copied from interface: DraftDao
      Returns all drafts stored in the data store.
      Specified by:
      findAll in interface DraftDao
    • countDrafts

      public int countDrafts(ConfluenceUser creator)
      Specified by:
      countDrafts in interface DraftDao
      Returns:
      count of number of drafts for this daos owner