public class VersionHistoryImpl extends Object implements VersionHistory
Constructor and Description |
---|
VersionHistoryImpl(Version rootVersion,
Comparator<Version> versionComparatorDesc)
Constructor, ensures the root version is set.
|
Modifier and Type | Method and Description |
---|---|
void |
addVersion(Version version,
Version predecessor)
Add a version to the version history, in the order they were
created.
|
Collection<Version> |
getAllVersions()
Gets a collection containing all the versions within the
version history.
|
Version |
getHeadVersion()
Gets the head (current / most recent) version of the version history.
|
Version |
getPredecessor(Version version)
Gets the predecessor of a specified version
|
Version |
getRootVersion()
Gets the root (initial / least recent) version of the version history.
|
Collection<Version> |
getSuccessors(Version version)
Gets the succeeding versions of a specified version.
|
Version |
getVersion(String versionLabel)
Gets a version with a specified version label.
|
String |
toString() |
public VersionHistoryImpl(Version rootVersion, Comparator<Version> versionComparatorDesc)
rootVersion
- the root version, can not be null.versionComparatorDesc
- optional comparator of versions.public Version getRootVersion()
getRootVersion
in interface VersionHistory
public Version getHeadVersion()
getHeadVersion
in interface VersionHistory
public Collection<Version> getAllVersions()
Versions are returned in descending create date order (most recent first).
getAllVersions
in interface VersionHistory
public Version getPredecessor(Version version)
getPredecessor
in interface VersionHistory
version
- the version objectpublic Collection<Version> getSuccessors(Version version)
getSuccessors
in interface VersionHistory
version
- the version objectpublic Version getVersion(String versionLabel)
getVersion
in interface VersionHistory
versionLabel
- the version labelVersionDoesNotExistException
- indicates requested version does not existpublic void addVersion(Version version, Version predecessor)
Used internally to build the version history tree.
version
- the version objectpredecessor
- the preceeding versionCopyright © 2005–2017 Alfresco Software. All rights reserved.