Class HibernateVersionHistoryDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<VersionHistory>
-
- com.atlassian.confluence.core.persistence.hibernate.HibernateVersionHistoryDao
-
- All Implemented Interfaces:
ObjectDao
,VersionHistoryDao
,ObjectDaoInternal<VersionHistory>
,VersionHistoryDaoInternal
,org.springframework.beans.factory.InitializingBean
public class HibernateVersionHistoryDao extends HibernateObjectDao<VersionHistory> implements VersionHistoryDaoInternal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability
-
-
Field Summary
-
Fields inherited from interface com.atlassian.confluence.core.persistence.VersionHistoryDao
UNKNOWN_BUILD_NUMBER
-
-
Constructor Summary
Constructors Constructor Description HibernateVersionHistoryDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBuildToHistory(int buildNumber)
The version history consists of a list of builds that Confluence has been successfully upgraded tovoid
finalizeBuild(int buildNumber)
Record the provided build number as finalized.int
getFinalizedBuildNumber()
Obtains the latest build number to have been finalized usingVersionHistoryDao.finalizeBuild(int)
.List<VersionHistory>
getFullUpgradeHistory()
int
getLatestBuildNumber()
Get the highest build number from the database.Class<VersionHistory>
getPersistentClass()
Gets the type ofEntityObject
this Dao works with.VersionHistory
getVersionHistory(int buildNumber)
boolean
tagBuild(int buildNumber, String tag)
We need to ensure that the checking and writing of the tag is atomic so as to prevent two or more nodes from writing the tag and reporting that it was set correctly-
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, getByClassId, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.internal.persistence.ObjectDaoInternal
findAll, findAllSorted, findAllSorted, findByClassIds, findByClassIdsFiltered, refresh, refreshEntity, remove, removeEntity, replicate, replicateEntity, save, saveEntity, saveRaw, saveRawEntity
-
Methods inherited from interface com.atlassian.confluence.internal.persistence.VersionHistoryDaoInternal
getUpgradeHistory
-
-
-
-
Method Detail
-
getPersistentClass
public Class<VersionHistory> getPersistentClass()
Description copied from interface:ObjectDaoInternal
Gets the type ofEntityObject
this Dao works with.- Specified by:
getPersistentClass
in interfaceObjectDao
- Specified by:
getPersistentClass
in interfaceObjectDaoInternal<VersionHistory>
- Returns:
- the type
-
getLatestBuildNumber
public int getLatestBuildNumber()
Description copied from interface:VersionHistoryDao
Get the highest build number from the database. This should represent what version the database thinks Confluence is running at, which in turn is used to schedule database-hitting upgrade tasks.If the number can not be determined (there are no versions in the database, or the version history table hasn't even been created yet) then the method will return UNKNOWN_BUILD_NUMBER. In this case, callers should assume that the database build number is identical to the configured build number.
- Specified by:
getLatestBuildNumber
in interfaceVersionHistoryDao
- Returns:
- the highest build number in version history table, or UNKNOWN_BUILD_NUMBER if that can not be determined.
-
getVersionHistory
public VersionHistory getVersionHistory(int buildNumber)
- Specified by:
getVersionHistory
in interfaceVersionHistoryDao
- Returns:
- the version history object associated with the build number (if there is more than one, return the latest)
-
tagBuild
public boolean tagBuild(int buildNumber, String tag)
We need to ensure that the checking and writing of the tag is atomic so as to prevent two or more nodes from writing the tag and reporting that it was set correctly- Specified by:
tagBuild
in interfaceVersionHistoryDao
- Returns:
- true if the build number was successfully tagged, false if the tag specified has already been associated with this build number
-
getFinalizedBuildNumber
public int getFinalizedBuildNumber()
Description copied from interface:VersionHistoryDao
Obtains the latest build number to have been finalized usingVersionHistoryDao.finalizeBuild(int)
.- Specified by:
getFinalizedBuildNumber
in interfaceVersionHistoryDao
- Returns:
- latest build number that has been finalized
-
finalizeBuild
public void finalizeBuild(int buildNumber)
Description copied from interface:VersionHistoryDao
Record the provided build number as finalized. This occurs when a cluster exists ZDU mode at the end of an upgrade, or is upgraded without ZDU mode.- Specified by:
finalizeBuild
in interfaceVersionHistoryDao
-
getFullUpgradeHistory
public List<VersionHistory> getFullUpgradeHistory()
- Specified by:
getFullUpgradeHistory
in interfaceVersionHistoryDaoInternal
-
addBuildToHistory
public void addBuildToHistory(int buildNumber)
Description copied from interface:VersionHistoryDao
The version history consists of a list of builds that Confluence has been successfully upgraded to- Specified by:
addBuildToHistory
in interfaceVersionHistoryDao
-
-