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:
javax.jcr.Item, javax.jcr.Node, javax.jcr.version.VersionHistory

public class VersionHistoryImpl
extends NodeImpl
implements javax.jcr.version.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)
           
 javax.jcr.version.VersionIterator getAllVersions()
           
protected  InternalVersionHistory getInternalVersionHistory()
          Returns the internal version history.
 javax.jcr.version.Version getRootVersion()
           
 javax.jcr.version.Version getVersion(String versionName)
           
 String getVersionableUUID()
          
 javax.jcr.version.Version getVersionByLabel(String label)
           
 String[] getVersionLabels()
           
 String[] getVersionLabels(javax.jcr.version.Version version)
           
 boolean hasVersionLabel(String label)
           
 boolean hasVersionLabel(javax.jcr.version.Version version, String label)
           
 boolean isSame(javax.jcr.Item otherItem)
          
 javax.jcr.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, canAddMixin, cancelMerge, checkin, checkLock, checkout, checkSetProperty, clone, computeSystemGeneratedPropertyValues, createChildNode, createChildProperty, doneMerge, 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, 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, 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, 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
id - node id
state - node state
definition - node definition
listeners - life cycle listeners
Method Detail

getInternalVersionHistory

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

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

getRootVersion

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

getAllVersions

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

getVersion

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

getVersionByLabel

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

addVersionLabel

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

removeVersionLabel

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

getVersionLabels

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

getVersionLabels

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

hasVersionLabel

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

hasVersionLabel

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

removeVersion

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

isSame

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

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

getVersionableUUID

public String getVersionableUUID()
                          throws javax.jcr.RepositoryException

Specified by:
getVersionableUUID in interface javax.jcr.version.VersionHistory
Throws:
javax.jcr.RepositoryException

update

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

Specified by:
update in interface javax.jcr.Node
Overrides:
update in class NodeImpl
Throws:
javax.jcr.nodetype.ConstraintViolationException

merge

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

Specified by:
merge in interface javax.jcr.Node
Overrides:
merge in class NodeImpl
Throws:
javax.jcr.nodetype.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-2011 Apache Software Foundation. All Rights Reserved.