Class HibernateDraftDao

  • All Implemented Interfaces:
    ObjectDao, ObjectDaoInternal, DraftDao, org.springframework.beans.factory.InitializingBean

    public class HibernateDraftDao
    extends HibernateObjectDao
    implements DraftDao
    Database storage for drafts. Does not permit anonymous drafts (i.e. those with a null username), which should be stored in non-permanent storage like the HTTP session.
    See Also:
    SessionDraftDao
    • Constructor Detail

      • HibernateDraftDao

        public HibernateDraftDao()
    • Method Detail

      • getByClassId

        protected Draft getByClassId​(long id)
        Description copied from class: HibernateObjectDao
        Retrieve the object with a particular id from the database. The object must be of the same class as the DAO's getPersistentClass() method returns.
        Overrides:
        getByClassId in class HibernateObjectDao
        Parameters:
        id - the id of the object to look up
        Returns:
        the corresponding object, or null if the object does not exist with the appropriate class and id.
      • getDraft

        public Draft getDraft​(String pageId,
                              ConfluenceUser creator,
                              String draftType,
                              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
        creator - the owner of the draft
        draftType - 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
      • countDrafts

        public int countDrafts​(String creatorName)
        Specified by:
        countDrafts in interface DraftDao
        Returns:
        count of number of drafts for this daos owner
      • setConfluenceUserDao

        public void setConfluenceUserDao​(ConfluenceUserDao confluenceUserDao)