Class HibernateDraftDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
-
- com.atlassian.confluence.pages.persistence.dao.hibernate.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability
-
-
Constructor Summary
Constructors Constructor Description HibernateDraftDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countDrafts(String creatorName)
List<Draft>
findByCreatorName(String creatorName)
Returns the drafts stored against the given username.protected Draft
getByClassId(long id)
Retrieve the object with a particular id from the database.Draft
getDraft(long draftId)
Returns the draft with the given ID, or null if no draft is found with that ID.Draft
getDraft(String pageId, ConfluenceUser creator, String draftType, String spaceKey)
Finds and returns a draft object with all the specified properties or null if none is found.Class
getPersistentClass()
Gets the type ofEntityObject
this Dao works with.void
remove(Draft draft)
Removes a draft based on its page ID, owner and type.void
saveOrUpdate(Draft draft)
Saves the draft.void
setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
-
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findAllSorted, findByClassIds, findByClassIdsFiltered, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getCountResult, getHibernateTemplate, getSessionFactory, index, indexEntity, refresh, refreshEntity, reIndex, reIndexEntity, remove, removeEntity, replicate, replicateEntity, save, saveEntity, saveRaw, saveRawEntity, setEventPublisher, setHibernateTemplate, setIndexer, setSessionFactory, unIndex, unIndexEntity, uniqueResult, updateEntityModificationData, updateModificationData
-
-
-
-
Method Detail
-
getPersistentClass
public Class getPersistentClass()
Description copied from interface:ObjectDaoInternal
Gets the type ofEntityObject
this Dao works with.- Specified by:
getPersistentClass
in interfaceObjectDao
- Specified by:
getPersistentClass
in interfaceObjectDaoInternal
- Returns:
- the type
-
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 classHibernateObjectDao
- 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.
-
saveOrUpdate
public void saveOrUpdate(Draft draft) throws IllegalArgumentException
Description copied from interface:DraftDao
Saves the draft.- Specified by:
saveOrUpdate
in interfaceDraftDao
- Throws:
IllegalArgumentException
- if the draft has no page ID, owner or type.
-
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 interfaceDraftDao
- Parameters:
pageId
- the id of the page which this draft is associated withcreator
- the owner of the draftdraftType
- the type of draft, which is usually the result of callingContentEntityObject.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.
-
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.
-
findByCreatorName
public List<Draft> findByCreatorName(String creatorName)
Description copied from interface:DraftDao
Returns the drafts stored against the given username.- Specified by:
findByCreatorName
in interfaceDraftDao
-
countDrafts
public int countDrafts(String creatorName)
- Specified by:
countDrafts
in interfaceDraftDao
- Returns:
- count of number of drafts for this daos owner
-
setConfluenceUserDao
public void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
-
-