org.apache.jackrabbit.core.version
Class VersionImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.ItemImpl
      extended by org.apache.jackrabbit.core.NodeImpl
          extended by org.apache.jackrabbit.core.version.VersionImpl
All Implemented Interfaces:
javax.jcr.Item, javax.jcr.Node, javax.jcr.version.Version

public class VersionImpl
extends NodeImpl
implements javax.jcr.version.Version

Base implementation of the Version 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
VersionImpl(ItemManager itemMgr, SessionImpl session, AbstractNodeData data)
          Create a new instance of this class.
 
Method Summary
 javax.jcr.version.VersionHistory getContainingHistory()
          
 Calendar getCreated()
          
 InternalFrozenNode getFrozenNode()
          Returns the frozen node of this version
protected  InternalVersion getInternalVersion()
          Returns the internal version.
 javax.jcr.version.Version[] getPredecessors()
          
 javax.jcr.version.Version[] getSuccessors()
          
 boolean isMoreRecent(VersionImpl v)
          Checks if this version is more recent than the given version v.
 boolean isRootVersion()
          Checks if this is the root version.
 boolean isSame(javax.jcr.Item otherItem)
          
 javax.jcr.NodeIterator merge(String srcWorkspace, boolean bestEffort)
          Always throws a ConstraintViolationException since this node is protected.
 String toString()
          Return a string representation of this version 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

VersionImpl

public VersionImpl(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

getInternalVersion

protected InternalVersion getInternalVersion()
                                      throws javax.jcr.RepositoryException
Returns the internal version. Subclass responsibility.

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

getCreated

public Calendar getCreated()
                    throws javax.jcr.RepositoryException

Specified by:
getCreated in interface javax.jcr.version.Version
Throws:
javax.jcr.RepositoryException

getSuccessors

public javax.jcr.version.Version[] getSuccessors()
                                          throws javax.jcr.RepositoryException

Specified by:
getSuccessors in interface javax.jcr.version.Version
Throws:
javax.jcr.RepositoryException

getPredecessors

public javax.jcr.version.Version[] getPredecessors()
                                            throws javax.jcr.RepositoryException

Specified by:
getPredecessors in interface javax.jcr.version.Version
Throws:
javax.jcr.RepositoryException

getContainingHistory

public javax.jcr.version.VersionHistory getContainingHistory()
                                                      throws javax.jcr.RepositoryException

Specified by:
getContainingHistory in interface javax.jcr.version.Version
Throws:
javax.jcr.RepositoryException

getFrozenNode

public InternalFrozenNode getFrozenNode()
                                 throws javax.jcr.RepositoryException
Returns the frozen node of this version

Returns:
Throws:
javax.jcr.RepositoryException

isSame

public boolean isSame(javax.jcr.Item otherItem)

Specified by:
isSame in interface javax.jcr.Item
Overrides:
isSame in class ItemImpl

isMoreRecent

public boolean isMoreRecent(VersionImpl v)
                     throws javax.jcr.RepositoryException
Checks if this version is more recent than the given version v. A version is more recent if and only if it is a successor (or a successor of a successor, etc., to any degree of separation) of the compared one.

Parameters:
v - the version to check
Returns:
true if the version is more recent; false otherwise.
Throws:
javax.jcr.RepositoryException

isRootVersion

public boolean isRootVersion()
                      throws javax.jcr.RepositoryException
Checks if this is the root version.

Returns:
true if this version is the root version; false otherwise.
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 node for diagnostic purposes.

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


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.