org.apache.jackrabbit.core.version
Class VersionHistoryImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.ItemImpl
      extended by org.apache.jackrabbit.core.NodeImpl
          extended by org.apache.jackrabbit.core.version.VersionHistoryImpl
All Implemented Interfaces:
Item, Node, VersionHistory

public class VersionHistoryImpl
extends NodeImpl
implements VersionHistory

Base implementation of the VersionHistory interface.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.NodeImpl
CREATED
 
Fields inherited from class org.apache.jackrabbit.core.ItemImpl
id, itemMgr, rep, session, stateMgr, STATUS_DESTROYED, STATUS_INVALIDATED, STATUS_MODIFIED, STATUS_NORMAL
 
Constructor Summary
VersionHistoryImpl(ItemManager itemMgr, SessionImpl session, AbstractNodeData data)
          Create a new instance of this class.
 
Method Summary
 void addVersionLabel(String versionName, String label, boolean move)
           
 NodeIterator getAllFrozenNodes()
          Returns an iterator over all the frozen nodes of all the versions of this version history.
 NodeIterator getAllLinearFrozenNodes()
          This method returns all the frozen nodes of all the versions in this verison history in the same order as VersionHistory.getAllLinearVersions().
 VersionIterator getAllLinearVersions()
          This method returns an iterator over all the versions in the line of descent from the root version to that base version within this history that is bound to the workspace through which this VersionHistory was accessed.
 VersionIterator getAllVersions()
           
protected  InternalVersionHistory getInternalVersionHistory()
          Returns the internal version history.
 Version getRootVersion()
           
 Version getVersion(String versionName)
           
 String getVersionableIdentifier()
          Returns the identifier of the versionable node for which this is the version history.
 String getVersionableUUID()
          
 Version getVersionByLabel(String label)
           
 String[] getVersionLabels()
           
 String[] getVersionLabels(Version version)
           
 boolean hasVersionLabel(String label)
           
 boolean hasVersionLabel(Version version, String label)
           
 boolean isSame(Item otherItem)
          
 NodeIterator merge(String srcWorkspace, boolean bestEffort)
          Always throws a ConstraintViolationException since this node is protected.
 void removeVersion(String versionName)
           
 void removeVersionLabel(String label)
           
 String toString()
          Return a string representation of this version history node for diagnostic purposes.
 void update(String srcWorkspaceName)
          Always throws a ConstraintViolationException since this node is protected.
 
Methods inherited from class org.apache.jackrabbit.core.NodeImpl
accept, addMixin, addMixin, addNode, addNode, addNode, addNodeWithUuid, addNodeWithUuid, canAddMixin, cancelMerge, checkin, checkin, checkLock, checkout, checkSetProperty, clone, computeSystemGeneratedPropertyValues, createChildNode, createChildProperty, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getApplicableChildNodeDefinition, getApplicablePropertyDefinition, getBaseVersion, getCorrespondingNodePath, getDefinition, getEffectiveNodeType, getIdentifier, getIndex, getLock, getMixinNodeTypes, getMixinTypeNames, getName, getNode, getNode, getNode, getNodeId, getNodes, getNodes, getOrCreateProperty, getOrCreateProperty, getOrCreateTransientItemState, getParent, getPrimaryItem, getPrimaryNodeType, getPrimaryPath, getProperties, getProperties, getProperty, getProperty, getQName, getReferences, getReferences, getSharedSet, getUUID, getVersionHistory, getWeakReferences, getWeakReferences, hasNode, hasNode, hasNode, hasNodes, hasPendingChanges, hasProperties, hasProperty, hasProperty, holdsLock, internalAddChildNode, internalAddChildNode, internalAddNode, internalAddNode, internalCopyPropertyFrom, internalGetUUID, internalIsCheckedOut, internalRestore, internalSetProperty, internalSetProperty, internalSetProperty, isCheckedOut, isLocked, isNode, isNodeType, isNodeType, lock, makePersistent, merge, onRedefine, onRemove, orderBefore, orderBefore, removeChildNode, removeChildProperty, removeChildProperty, removeMixin, removeMixin, removeShare, removeSharedSet, renameChildNode, replaceChildNode, resolveRelativeNodePath, resolveRelativePropertyPath, restore, restore, restore, restoreByLabel, restoreTransient, setPrimaryType, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock
 
Methods inherited from class org.apache.jackrabbit.core.ItemImpl
getAncestor, getDepth, getId, getPath, getSession, internalRemove, isModified, isNew, isTransactionalNew, isTransient, refresh, remove, safeGetJCRPath, sanityCheck, save, setRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jcr.Node
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, getBaseVersion, getCorrespondingNodePath, getDefinition, getIndex, getLock, getMixinNodeTypes, getNode, getNodes, getNodes, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperty, getReferences, getUUID, getVersionHistory, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, isCheckedOut, isLocked, isNodeType, lock, orderBefore, removeMixin, restore, restore, restore, restoreByLabel, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock
 
Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, refresh, remove, save
 

Constructor Detail

VersionHistoryImpl

public VersionHistoryImpl(ItemManager itemMgr,
                          SessionImpl session,
                          AbstractNodeData data)
Create a new instance of this class.

Parameters:
itemMgr - item manager
session - session
data - node data
Method Detail

getInternalVersionHistory

protected InternalVersionHistory getInternalVersionHistory()
                                                    throws RepositoryException
Returns the internal version history. Subclass responsibility.

Returns:
internal version history
Throws:
RepositoryException - if the internal version history is not available

getRootVersion

public Version getRootVersion()
                       throws RepositoryException
Specified by:
getRootVersion in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.getRootVersion()

getAllVersions

public VersionIterator getAllVersions()
                               throws RepositoryException
Specified by:
getAllVersions in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.getAllVersions()

getAllFrozenNodes

public NodeIterator getAllFrozenNodes()
                               throws RepositoryException
Description copied from interface: VersionHistory
Returns an iterator over all the frozen nodes of all the versions of this version history. Under simple versioning the order of the returned nodes will be the order of their creation. Under full versioning the order is implementation-dependent.

Returns:
a NodeIterator object.
Throws:
RepositoryException - if an error occurs.
See Also:
VersionHistory.getAllFrozenNodes()

getAllLinearVersions

public VersionIterator getAllLinearVersions()
                                     throws RepositoryException
Description copied from interface: VersionHistory
This method returns an iterator over all the versions in the line of descent from the root version to that base version within this history that is bound to the workspace through which this VersionHistory was accessed.

Within a version history H, B is the base version bound to workspace W if and only if there exists a versionable node N in W whose version history is H and B is the base version of N.

The line of descent from version V1 to V2, where V2 is a successor of V1, is the ordered list of versions starting with V1 and proceeding through each direct successor to V2.

The versions are returned in order of creation date, from oldest to newest.

Note that in a simple versioning repository the behavior of this method is equivalent to returning all versions in the version history in order from oldest to newest.

Returns:
a VersionIterator object.
Throws:
RepositoryException - if an error occurs.
See Also:
VersionHistory.getAllLinearVersions()

getAllLinearFrozenNodes

public NodeIterator getAllLinearFrozenNodes()
                                     throws RepositoryException
Description copied from interface: VersionHistory
This method returns all the frozen nodes of all the versions in this verison history in the same order as VersionHistory.getAllLinearVersions().

Returns:
a NodeIterator object.
Throws:
RepositoryException - if an error occurs.
See Also:
VersionHistory.getAllLinearFrozenNodes()

getVersion

public Version getVersion(String versionName)
                   throws VersionException,
                          RepositoryException
Specified by:
getVersion in interface VersionHistory
Throws:
VersionException
RepositoryException
See Also:
VersionHistory.getVersion(String)

getVersionByLabel

public Version getVersionByLabel(String label)
                          throws RepositoryException
Specified by:
getVersionByLabel in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.getVersionByLabel(String)

addVersionLabel

public void addVersionLabel(String versionName,
                            String label,
                            boolean move)
                     throws VersionException,
                            RepositoryException
Specified by:
addVersionLabel in interface VersionHistory
Throws:
VersionException
RepositoryException
See Also:
VersionHistory.addVersionLabel(String, String, boolean)

removeVersionLabel

public void removeVersionLabel(String label)
                        throws RepositoryException
Specified by:
removeVersionLabel in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.removeVersionLabel(String)

getVersionLabels

public String[] getVersionLabels()
                          throws RepositoryException
Specified by:
getVersionLabels in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.getVersionLabels()

getVersionLabels

public String[] getVersionLabels(Version version)
                          throws VersionException,
                                 RepositoryException
Specified by:
getVersionLabels in interface VersionHistory
Throws:
VersionException
RepositoryException
See Also:
VersionHistory.getVersionLabels(javax.jcr.version.Version)

hasVersionLabel

public boolean hasVersionLabel(String label)
                        throws RepositoryException
Specified by:
hasVersionLabel in interface VersionHistory
Throws:
RepositoryException
See Also:
VersionHistory.hasVersionLabel(String)

hasVersionLabel

public boolean hasVersionLabel(Version version,
                               String label)
                        throws VersionException,
                               RepositoryException
Specified by:
hasVersionLabel in interface VersionHistory
Throws:
VersionException
RepositoryException
See Also:
VersionHistory.hasVersionLabel(javax.jcr.version.Version, String)

removeVersion

public void removeVersion(String versionName)
                   throws UnsupportedRepositoryOperationException,
                          VersionException,
                          RepositoryException
Specified by:
removeVersion in interface VersionHistory
Throws:
UnsupportedRepositoryOperationException
VersionException
RepositoryException
See Also:
VersionHistory.removeVersion(String)

isSame

public boolean isSame(Item otherItem)
Description copied from class: ItemImpl

Specified by:
isSame in interface Item
Overrides:
isSame in class ItemImpl
See Also:
Item.isSame(javax.jcr.Item)

getVersionableUUID

public String getVersionableUUID()
                          throws RepositoryException

Specified by:
getVersionableUUID in interface VersionHistory
Throws:
RepositoryException

getVersionableIdentifier

public String getVersionableIdentifier()
                                throws RepositoryException
Returns the identifier of the versionable node for which this is the version history.

Returns:
the identifier of the versionable node for which this is the version history.
Throws:
RepositoryException - if an error occurs.

update

public void update(String srcWorkspaceName)
            throws ConstraintViolationException
Always throws a ConstraintViolationException since this node is protected.

Specified by:
update in interface Node
Overrides:
update in class NodeImpl
Throws:
ConstraintViolationException

merge

public NodeIterator merge(String srcWorkspace,
                          boolean bestEffort)
                   throws ConstraintViolationException
Always throws a ConstraintViolationException since this node is protected.

Specified by:
merge in interface Node
Overrides:
merge in class NodeImpl
Throws:
ConstraintViolationException

toString

public String toString()
Return a string representation of this version history node for diagnostic purposes.

Overrides:
toString in class NodeImpl
Returns:
"version history node /path/to/item"


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.