Class DefaultContentDao
- All Implemented Interfaces:
ContentDao
,ContentDaoInternal
,org.springframework.beans.factory.InitializingBean
For this reason, you should always do object CRUD through the DAO, you shouldn't trust Hibernate to do it for you: Hibernate will save the object, but skip the additional stuff the DAO does.
Subclasses will need to implement the HibernateObjectDao.getPersistentClass()
method to return the class
that the DAO is serving: that way getByClassId() will perform correctly.
Subclasses should also override HibernateObjectDao.updateModificationData(EntityObject)
if they want to perform
any additional modifications on objects that are being saved through the DAO. Just
remember to call super. (updateModificationData
will not be called if an
object is saved through #saveRawEntity(EntityObject)
)
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetById
(long id) int
This is for internal use only, Do not rely on it as a public API.int
This is for internal use only, Do not rely on it as a public API.int
This is for internal use only, Do not rely on it as a public API.int
getLatestOrderedWikiContentFromContentId
(long startContentId, int maxRows) getLatestOrderedXhtmlContentFromContentIds
(long startContentId, long endContentId) This is for internal use only, Do not rely on it as a public API.getLatestOrderedXhtmlContentIds
(long startContentId, int maxRows) This is for internal use only, Do not rely on it as a public API.getOrderedXhtmlContentFromContentId
(long startContentId, int maxRows) This is for internal use only, Do not rely on it as a public API.getXhtmlSpaceDescriptionsFromContentId
(long startContentId, int maxRows) This is for internal use only, Do not rely on it as a public API.void
saveRawWithoutReindex
(com.atlassian.core.bean.EntityObject objectToSave) This is for internal use only, Do not rely on it as a public API.protected void
updateModificationData
(ContentEntityObject objectToSave) This method overrides the default behaviour which is to get the current user from a thread local and to set the last updated time to the current time.Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
applyChildVersioningPolicy, findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, findLatestVersionsIterator, findNamedQueryStringParams, findNamedQueryStringParams, remove, save
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, getHibernateTemplate, getSessionFactory, publishEvent, reIndex, save, saveEntity, saveRaw, setHibernateTemplate, setSessionFactory, uniqueResult
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
DefaultContentDao
public DefaultContentDao()
-
-
Method Details
-
getPersistentClass
- Specified by:
getPersistentClass
in classHibernateObjectDao<ContentEntityObject>
-
getById
- Specified by:
getById
in interfaceContentDao
-
getLatestContentCount
public int getLatestContentCount()- Specified by:
getLatestContentCount
in interfaceContentDao
-
getLatestOrderedWikiContentFromContentId
public List<ContentEntityObject> getLatestOrderedWikiContentFromContentId(long startContentId, int maxRows) - Specified by:
getLatestOrderedWikiContentFromContentId
in interfaceContentDao
- Parameters:
startContentId
- start content idmaxRows
- max rows- Returns:
- the latest versions of wiki content within the specified bounds
-
getOrderedXhtmlContentFromContentId
public List<ContentEntityObject> getOrderedXhtmlContentFromContentId(long startContentId, int maxRows) Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API. This is used to retrieve batches of data during migration or upgrades.
Warning: You will want to keep maxRows as small as possible because a list of CEO can be a very memory hungry structure. A good example is the default used in content migration which is 500.
- Specified by:
getOrderedXhtmlContentFromContentId
in interfaceContentDao
- Returns:
- a list ordered by id of all the ContentEntityObjects with XHTML formatted bodies.
-
getLatestOrderedXhtmlContentFromContentIds
public List<ContentEntityObject> getLatestOrderedXhtmlContentFromContentIds(long startContentId, long endContentId) Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API. This is used to retrieve batches of data during migration or upgrades.
Warning: You will want to keep maxRows as small as possible because a list of CEO can be a very memory hungry structure. A good example is the default used in content migration which is 500.
- Specified by:
getLatestOrderedXhtmlContentFromContentIds
in interfaceContentDao
- Returns:
- a list ordered by id of all the latest ContentEntityObjects with XHTML formatted bodies.
-
getLatestOrderedXhtmlContentIds
Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API. This is used to retrieve batches of data during migration or upgrades.
- Specified by:
getLatestOrderedXhtmlContentIds
in interfaceContentDao
- Returns:
- a ordered list of IDs of all the latest ContentEntityObjects with XHTML formatted bodies.
-
getCountOfXhtmlContent
public int getCountOfXhtmlContent()Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API.
This is used to calculate the amount of work required when migrating or upgrading content.
- Specified by:
getCountOfXhtmlContent
in interfaceContentDao
- Returns:
- the number of CEO's with XHTML content.
-
getCountOfLatestXhtmlContent
public int getCountOfLatestXhtmlContent()Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API.
This is used to calculate the amount of work required when migrating or upgrading content.
- Specified by:
getCountOfLatestXhtmlContent
in interfaceContentDao
- Returns:
- the number of latest CEO's with XHTML content.
-
saveRawWithoutReindex
public void saveRawWithoutReindex(com.atlassian.core.bean.EntityObject objectToSave) Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API.
Perform a saveRaw but without performing the re-index; it is unnecessary in the context of a migration or upgrade.
- Specified by:
saveRawWithoutReindex
in interfaceContentDao
-
getXhtmlSpaceDescriptionsFromContentId
public List<ContentEntityObject> getXhtmlSpaceDescriptionsFromContentId(long startContentId, int maxRows) Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API. This is used to retrieve batches of data during migration or upgrades.
Warning: You will want to keep maxRows as small as possible because a list of CEO can be a very memory hungry structure. A good example is the default used in content migration which is 500.
- Specified by:
getXhtmlSpaceDescriptionsFromContentId
in interfaceContentDao
- Returns:
- a list ordered by id of all the SpaceDescriptions with BodyContent of type BodyType.XHTML
-
getCountOfXhtmlSpaceDescriptions
public int getCountOfXhtmlSpaceDescriptions()Description copied from interface:ContentDao
This is for internal use only, Do not rely on it as a public API.
This is used to calculate the amount of work required when migrating or upgrading content.
- Specified by:
getCountOfXhtmlSpaceDescriptions
in interfaceContentDao
- Returns:
- the number of SpaceDescriptions with BodyContent of type BodyType.XHTML
-
updateModificationData
This method overrides the default behaviour which is to get the current user from a thread local and to set the last updated time to the current time. We do not want this for the migration.We do however need to set the creationdate if it is not set.
- Overrides:
updateModificationData
in classConfluenceHibernateObjectDao<ContentEntityObject>
- Parameters:
objectToSave
- the object that is about to be saved
-