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) intThis is for internal use only, Do not rely on it as a public API.intThis is for internal use only, Do not rely on it as a public API.intThis is for internal use only, Do not rely on it as a public API.intgetLatestOrderedWikiContentFromContentId(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.voidsaveRawWithoutReindex(com.atlassian.core.bean.EntityObject objectToSave) This is for internal use only, Do not rely on it as a public API.protected voidupdateModificationData(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, remove, saveMethods inherited from class com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
findNamedQueryStringParams, getContentStatusStringList, getStatusNames, scanFilteredContents, scanFilteredContentsMethods 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, uniqueResultMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDaoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.content.render.xhtml.migration.ContentDao
save, save
-
Constructor Details
-
DefaultContentDao
public DefaultContentDao()
-
-
Method Details
-
getPersistentClass
- Specified by:
getPersistentClassin classHibernateObjectDao<ContentEntityObject>
-
getById
- Specified by:
getByIdin interfaceContentDao
-
getLatestContentCount
public int getLatestContentCount()- Specified by:
getLatestContentCountin interfaceContentDao
-
getLatestOrderedWikiContentFromContentId
public List<ContentEntityObject> getLatestOrderedWikiContentFromContentId(long startContentId, int maxRows) - Specified by:
getLatestOrderedWikiContentFromContentIdin 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:ContentDaoThis 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:
getOrderedXhtmlContentFromContentIdin 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:ContentDaoThis 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:
getLatestOrderedXhtmlContentFromContentIdsin interfaceContentDao- Returns:
- a list ordered by id of all the latest ContentEntityObjects with XHTML formatted bodies.
-
getLatestOrderedXhtmlContentIds
Description copied from interface:ContentDaoThis 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:
getLatestOrderedXhtmlContentIdsin interfaceContentDao- Returns:
- a ordered list of IDs of all the latest ContentEntityObjects with XHTML formatted bodies.
-
getCountOfXhtmlContent
public int getCountOfXhtmlContent()Description copied from interface:ContentDaoThis 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:
getCountOfXhtmlContentin interfaceContentDao- Returns:
- the number of CEO's with XHTML content.
-
getCountOfLatestXhtmlContent
public int getCountOfLatestXhtmlContent()Description copied from interface:ContentDaoThis 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:
getCountOfLatestXhtmlContentin 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:ContentDaoThis 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:
saveRawWithoutReindexin interfaceContentDao
-
getXhtmlSpaceDescriptionsFromContentId
public List<ContentEntityObject> getXhtmlSpaceDescriptionsFromContentId(long startContentId, int maxRows) Description copied from interface:ContentDaoThis 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:
getXhtmlSpaceDescriptionsFromContentIdin 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:ContentDaoThis 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:
getCountOfXhtmlSpaceDescriptionsin 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:
updateModificationDatain classConfluenceHibernateObjectDao<ContentEntityObject>- Parameters:
objectToSave- the object that is about to be saved
-