Daisy Open Source CMS

org.outerj.daisy.workflow
Class WfVersionKey

java.lang.Object
  extended by org.outerj.daisy.workflow.WfVersionKey
All Implemented Interfaces:
Comparable

public class WfVersionKey
extends Object
implements Comparable

A pointer to a specific version of a document variant.

This object is immutable.


Constructor Summary
WfVersionKey(String documentId, long branchId, long languageId, String version)
           
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object obj)
           
static WfVersionKey get(Document document, String version)
          Convenience method to construct a WfVersionKey object from the given document and version string.
 long getBranchId()
           
 String getDocumentId()
           
 long getLanguageId()
           
 VariantKey getVariantKey()
          Gets a VariantKey equivalent to this WfVersionKey (missing the version information of course).
 String getVersion()
          Version (number or live/last), can be null.
 Version getVersion(Repository repository)
          Retrieve the document version pointed to by this key from the given repository.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WfVersionKey

public WfVersionKey(String documentId,
                    long branchId,
                    long languageId,
                    String version)
Parameters:
version - a version number, or the strings live/LIVE or last/LAST
Method Detail

getDocumentId

public String getDocumentId()

getBranchId

public long getBranchId()

getLanguageId

public long getLanguageId()

getVersion

public String getVersion()
Version (number or live/last), can be null.


compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getVariantKey

public VariantKey getVariantKey()
Gets a VariantKey equivalent to this WfVersionKey (missing the version information of course).


getVersion

public Version getVersion(Repository repository)
                   throws RepositoryException
Retrieve the document version pointed to by this key from the given repository. If the version component of this WfVersionKey is null, the last version will be returned.

Throws:
RepositoryException

get

public static WfVersionKey get(Document document,
                               String version)
Convenience method to construct a WfVersionKey object from the given document and version string.


Daisy Open Source CMS