Package org.alfresco.repo.version.common
Class VersionHistoryImpl
java.lang.Object
org.alfresco.repo.version.common.VersionHistoryImpl
- All Implemented Interfaces:
Serializable,VersionHistory
Version History implementation.
- Author:
- Roy Wetherall
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVersionHistoryImpl(Version rootVersion, Comparator<Version> versionComparatorDesc) Constructor, ensures the root version is set. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVersion(Version version, Version predecessor) Add a version to the version history, in the order they were created.Gets a collection containing all the versions within the version history.Gets the head (current / most recent) version of the version history.getPredecessor(Version version) Gets the predecessor of a specified versionGets the root (initial / least recent) version of the version history.getSuccessors(Version version) Gets the succeeding versions of a specified version.getVersion(String versionLabel) Gets a version with a specified version label.toString()
-
Constructor Details
-
VersionHistoryImpl
Constructor, ensures the root version is set.- Parameters:
rootVersion- the root version, can not be null.versionComparatorDesc- optional comparator of versions.
-
-
Method Details
-
getRootVersion
Gets the root (initial / least recent) version of the version history.- Specified by:
getRootVersionin interfaceVersionHistory- Returns:
- the root version
-
getHeadVersion
Gets the head (current / most recent) version of the version history.- Specified by:
getHeadVersionin interfaceVersionHistory- Returns:
- the head version
-
getAllVersions
Gets a collection containing all the versions within the version history.Versions are returned in descending create date order (most recent first).
- Specified by:
getAllVersionsin interfaceVersionHistory- Returns:
- collection containing all the versions
-
getPredecessor
Gets the predecessor of a specified version- Specified by:
getPredecessorin interfaceVersionHistory- Parameters:
version- the version object- Returns:
- the predeceeding version, null if root version
-
getSuccessors
Gets the succeeding versions of a specified version. If there are multiple Versions they are sorted into descending create date order (most recent first).- Specified by:
getSuccessorsin interfaceVersionHistory- Parameters:
version- the version object- Returns:
- a collection containing the succeeding version, empty is none
-
getVersion
Gets a version with a specified version label. The version label is guaranteed unique within the version history.- Specified by:
getVersionin interfaceVersionHistory- Parameters:
versionLabel- the version label- Returns:
- the version object
- Throws:
VersionDoesNotExistException- indicates requested version does not exist
-
addVersion
Add a version to the version history, in the order they were created.Used internally to build the version history tree.
- Parameters:
version- the version objectpredecessor- the preceeding version
-
toString
-