Class HibernateDraftDao
java.lang.Object
org.springframework.dao.support.DaoSupport
com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<Draft>
com.atlassian.confluence.impl.pages.persistence.dao.HibernateDraftDao
- All Implemented Interfaces:
DraftDao
,org.springframework.beans.factory.InitializingBean
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability, HibernateObjectDao.HibernateOperations
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
countDrafts
(ConfluenceUser creator) findAll()
Find all objects of the class provided by getPersistentClass()findByCreator
(ConfluenceUser creator) Returns the drafts stored against the given username.protected Draft
getByClassId
(long id) Retrieve the object with a particular id from the database.getDraft
(long draftId) Returns the draft with the given ID, or null if no draft is found with that ID.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.protected void
void
Remove an object from the databasevoid
saveOrUpdate
(Draft draft) Saves the draft.void
setEventPublisher
(com.atlassian.event.api.EventPublisher eventPublisher) Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAllSorted, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getCountResult, getHibernateTemplate, getSessionFactory, hibernate, reIndex, save, saveEntity, saveRaw, setHibernateTemplate, setSessionFactory, uniqueResult, updateModificationData
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
HibernateDraftDao
public HibernateDraftDao(org.hibernate.SessionFactory sessionFactory)
-
-
Method Details
-
getPersistentClass
- Specified by:
getPersistentClass
in classHibernateObjectDao<Draft>
-
getByClassId
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<Draft>
- 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
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
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
Description copied from interface:DraftDao
Returns the draft with the given ID, or null if no draft is found with that ID. -
remove
Description copied from class:HibernateObjectDao
Remove an object from the database- Specified by:
remove
in interfaceDraftDao
- Overrides:
remove
in classHibernateObjectDao<Draft>
- Parameters:
draft
- the object to remove
-
findByCreator
Description copied from interface:DraftDao
Returns the drafts stored against the given username.- Specified by:
findByCreator
in interfaceDraftDao
-
countDrafts
- Specified by:
countDrafts
in interfaceDraftDao
- Returns:
- count of number of drafts for this daos owner
-
findAll
Description copied from class:HibernateObjectDao
Find all objects of the class provided by getPersistentClass()- Specified by:
findAll
in interfaceDraftDao
- Overrides:
findAll
in classHibernateObjectDao<Draft>
- Returns:
- a list of all objects of the appropriate class, or the empty list if no objects are found
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) -
publishEvent
- Overrides:
publishEvent
in classHibernateObjectDao<Draft>
-