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:
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
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
countDrafts
(String creatorName) 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.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
Removes a draft based on its page ID, owner and type.void
saveOrUpdate
(Draft draft) Saves the draft.void
setConfluenceUserDao
(ConfluenceUserDao confluenceUserDao) void
setEventPublisher
(com.atlassian.event.api.EventPublisher eventPublisher) Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getCountResult, getHibernateTemplate, getSessionFactory, reIndex, remove, save, saveEntity, saveRaw, setHibernateTemplate, setSessionFactory, uniqueResult, updateModificationData
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
HibernateDraftDao
public HibernateDraftDao()
-
-
Method Details
-
getPersistentClass
- Specified by:
getPersistentClass
in classHibernateObjectDao
-
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
- 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 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
Description copied from interface:DraftDao
Returns the drafts stored against the given username.- Specified by:
findByCreatorName
in interfaceDraftDao
-
countDrafts
- Specified by:
countDrafts
in interfaceDraftDao
- Returns:
- count of number of drafts for this daos owner
-
setConfluenceUserDao
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) -
publishEvent
- Overrides:
publishEvent
in classHibernateObjectDao
-