org.alfresco.repo.version.common
Class VersionHistoryImpl

java.lang.Object
  extended by org.alfresco.repo.version.common.VersionHistoryImpl
All Implemented Interfaces:
java.io.Serializable, VersionHistory

public class VersionHistoryImpl
extends java.lang.Object
implements VersionHistory

Version History implementation.

See Also:
Serialized Form

Nested Class Summary
static class VersionHistoryImpl.VersionComparatorAsc
          Version Comparator Note: Ascending (last modified) date order
static class VersionHistoryImpl.VersionComparatorDesc
          Version Comparator Note: Descending (last modified) date order
 
Constructor Summary
VersionHistoryImpl(Version rootVersion)
          Constructor, ensures the root version is set.
 
Method Summary
 void addVersion(Version version, Version predecessor)
          Add a version to the version history.
 java.util.Collection 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.
 java.util.Collection getSuccessors(Version version)
          Gets the succeeding versions of a specified version.
 Version getVersion(java.lang.String versionLabel)
          Gets a version with a specified version label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionHistoryImpl

public VersionHistoryImpl(Version rootVersion)
Constructor, ensures the root version is set.

Parameters:
rootVersion - the root version, can not be null.
Method Detail

getRootVersion

public Version getRootVersion()
Gets the root (initial / least recent) version of the version history.

Specified by:
getRootVersion in interface VersionHistory
Returns:
the root version

getHeadVersion

public Version getHeadVersion()
Gets the head (current / most recent) version of the version history.

Specified by:
getHeadVersion in interface VersionHistory
Returns:
the head version

getAllVersions

public java.util.Collection 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:
getAllVersions in interface VersionHistory
Returns:
collection containing all the versions

getPredecessor

public Version getPredecessor(Version version)
Gets the predecessor of a specified version

Specified by:
getPredecessor in interface VersionHistory
Parameters:
version - the version object
Returns:
the predeceeding version, null if root version

getSuccessors

public java.util.Collection getSuccessors(Version version)
Gets the succeeding versions of a specified version.

Specified by:
getSuccessors in interface VersionHistory
Parameters:
version - the version object
Returns:
a collection containing the succeeding version, empty is none

getVersion

public Version getVersion(java.lang.String versionLabel)
Gets a version with a specified version label. The version label is guarenteed unique within the version history.

Specified by:
getVersion in interface VersionHistory
Parameters:
versionLabel - the version label
Returns:
the version object
Throws:
VersionDoesNotExistException - indicates requested version does not exisit

addVersion

public void addVersion(Version version,
                       Version predecessor)
Add a version to the version history.

Used internally to build the version history tree.

Parameters:
version - the version object
predecessor - the preceeding version


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.