Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 1 (1.3)

E11993-02


oracle.ocs.jcr.version
Interface OracleVersionHistory

All Superinterfaces:
javax.jcr.Item, javax.jcr.Node, javax.jcr.version.VersionHistory

public interface OracleVersionHistory
extends javax.jcr.version.VersionHistory

A VersionHistory object wraps an nt:versionHistory node. It provides convenient access to version history information.


Method Summary
 void addVersionLabel(java.lang.String versionName, java.lang.String label, boolean moveLabel)
          Adds the specified label to the specified version.
 javax.jcr.version.VersionIterator getAllVersions()
          Returns an iterator over all the versions within this version history The order of the returned objects will not necessarily correspond to the order of versions in terms of the successor relation.
 javax.jcr.version.Version getRootVersion()
          Returns the root version of this version history.
 javax.jcr.version.Version getVersion(java.lang.String versionName)
          Retrieves a particular version from this version history by version name.
 java.lang.String getVersionableUUID()
          Returns the UUID of the versionable node for which this is the version history.
 javax.jcr.version.Version getVersionByLabel(java.lang.String label)
          Retrieves a particular version from this version history by version label.
 java.lang.String[] getVersionLabels()
          Returns all version labels of the history or an empty array if there are none.
 java.lang.String[] getVersionLabels(javax.jcr.version.Version version)
          Returns all version labels of the given version - empty array if none.
 boolean hasVersionLabel(java.lang.String label)
          Returns true if any version in the history has the given label.
 boolean hasVersionLabel(javax.jcr.version.Version version, java.lang.String label)
          Returns true if the given version has the given label.
 void removeVersion(java.lang.String versionName)
          Removes the named version from this version history and automatically repairs the version graph.
 void removeVersionLabel(java.lang.String label)
          Removes the specified label from among the labels of this version history.

 

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, merge, orderBefore, removeMixin, restore, restore, restore, restoreByLabel, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock, update

 

Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, isSame, refresh, remove, save

 

Method Detail

getVersionableUUID

java.lang.String getVersionableUUID()
                                    throws javax.jcr.RepositoryException
Returns the UUID of the versionable node for which this is the version history.
Specified by:
getVersionableUUID in interface javax.jcr.version.VersionHistory
Returns:
the UUID of the versionable node for which this is the version history.
Throws:
javax.jcr.RepositoryException - if an error occurs.

getRootVersion

javax.jcr.version.Version getRootVersion()
                                         throws javax.jcr.RepositoryException
Returns the root version of this version history.
Specified by:
getRootVersion in interface javax.jcr.version.VersionHistory
Returns:
a Version object.
Throws:
javax.jcr.RepositoryException - if an error occurs.

getAllVersions

javax.jcr.version.VersionIterator getAllVersions()
                                                 throws javax.jcr.RepositoryException
Returns an iterator over all the versions within this version history The order of the returned objects will not necessarily correspond to the order of versions in terms of the successor relation. To traverse the version graph one must traverse the jcr:successor REFERENCE properties starting with the root version. A version history will always have at least one version, the root version. Therefore, this method will always return an iterator of at least size 1.
Specified by:
getAllVersions in interface javax.jcr.version.VersionHistory
Returns:
a VersionIterator object.
Throws:
javax.jcr.RepositoryException - if an error occurs.

getVersion

javax.jcr.version.Version getVersion(java.lang.String versionName)
                                     throws javax.jcr.version.VersionException,
                                            javax.jcr.RepositoryException
Retrieves a particular version from this version history by version name. <p/> Throws a VersionException if the specified version is not in this version history.
Specified by:
getVersion in interface javax.jcr.version.VersionHistory
Parameters:
versionName - a version name
Returns:
a Version object.
Throws:
javax.jcr.version.VersionException - if the specified version is not in this version history.
javax.jcr.RepositoryException - if an error occurs.

getVersionByLabel

javax.jcr.version.Version getVersionByLabel(java.lang.String label)
                                            throws javax.jcr.RepositoryException
Retrieves a particular version from this version history by version label. <p/> Throws a VersionException if the specified label is not in this version history.
Specified by:
getVersionByLabel in interface javax.jcr.version.VersionHistory
Parameters:
label - a version label
Returns:
a Version object.
Throws:
javax.jcr.version.VersionException - if the specified label is not in this version history.
javax.jcr.RepositoryException - if an error occurs.

addVersionLabel

void addVersionLabel(java.lang.String versionName,
                     java.lang.String label,
                     boolean moveLabel)
                     throws javax.jcr.version.VersionException,
                            javax.jcr.RepositoryException
Adds the specified label to the specified version. This corresponds to updating (or replacing earlier label value) a value to the jcr:versionLabels property of the nt:version node that represents the specified version. <p/> Note that this change is made immediately; there is no need to call save. In fact, since the the version storage is read-only with respect to normal repository methods, save does not even function in this context. <p/> Within a particular version history, a given label may appear a maximum of once. If the specified label is already assigned to a version in this history and moveLabel is true then the label is removed from its current location and added to the version with the specified versionName. If moveLabel is false, then an attempt to add a label that already exists in this version history will throw a VersionException. <p/> A VersionException is also thrown if the named version is not in this VersionHistory or if it is the root version (jcr:rootVersion) or if the label specified is not a valid JCR NAME.
Specified by:
addVersionLabel in interface javax.jcr.version.VersionHistory
Parameters:
versionName - the name of the version to which the label is to be added.
label - the label to be added.
moveLabel - - if true, then if label is already assigned to a version in this version history, it is moved to the new version specified; if false, then attempting to assign an already used label will throw a VersionException.
Throws:
javax.jcr.version.VersionException - if the specified version does not exist in this version history or if the specified version is the root version (jcr:rootVersion).
javax.jcr.RepositoryException - if another error occurs.

removeVersionLabel

void removeVersionLabel(java.lang.String label)
                        throws javax.jcr.version.VersionException,
                               javax.jcr.RepositoryException
Removes the specified label from among the labels of this version history. This corresponds to removing a property from the jcr:versionLabels child node of the nt:versionHistory node that represents this version history. <p/> Note that this change is made immediately; there is no need to call save. In fact, since the the version storage is read-only with respect to normal repository methods, save does not even function in this context. <p/> If a label is specified that does not exist in this version history, a VersionException is thrown.
Specified by:
removeVersionLabel in interface javax.jcr.version.VersionHistory
Parameters:
label - a version label
Throws:
javax.jcr.version.VersionException - if the name label does not exist in this version history.
javax.jcr.RepositoryException - if another error occurs.

hasVersionLabel

boolean hasVersionLabel(java.lang.String label)
                        throws javax.jcr.RepositoryException
Returns true if any version in the history has the given label.
Specified by:
hasVersionLabel in interface javax.jcr.version.VersionHistory
Parameters:
label - a version label
Returns:
a boolean.
Throws:
javax.jcr.RepositoryException - if an error occurs.

hasVersionLabel

boolean hasVersionLabel(javax.jcr.version.Version version,
                        java.lang.String label)
                        throws javax.jcr.version.VersionException,
                               javax.jcr.RepositoryException
Returns true if the given version has the given label.
Specified by:
hasVersionLabel in interface javax.jcr.version.VersionHistory
Parameters:
version - a Version object
label - a version label
Returns:
a boolean.
Throws:
javax.jcr.version.VersionException - if the specified version is not of this version history.
javax.jcr.RepositoryException - if another error occurs.

getVersionLabels

java.lang.String[] getVersionLabels()
                                    throws javax.jcr.RepositoryException
Returns all version labels of the history or an empty array if there are none.
Specified by:
getVersionLabels in interface javax.jcr.version.VersionHistory
Returns:
a String array containing all the labels of the version history.
Throws:
javax.jcr.RepositoryException - if an error occurs.

getVersionLabels

java.lang.String[] getVersionLabels(javax.jcr.version.Version version)
                                    throws javax.jcr.version.VersionException,
                                           javax.jcr.RepositoryException
Returns all version labels of the given version - empty array if none. Throws a VersionException if the specified version is not in this version history.
Specified by:
getVersionLabels in interface javax.jcr.version.VersionHistory
Parameters:
version -
Returns:
a String array containing all the labels of the given version
Throws:
javax.jcr.version.VersionException - if the specified version is not in this version history.
javax.jcr.RepositoryException - if another error occurs.

removeVersion

void removeVersion(java.lang.String versionName)
                   throws javax.jcr.ReferentialIntegrityException,
                          javax.jcr.AccessDeniedException,
                          javax.jcr.UnsupportedRepositoryOperationException,
                          javax.jcr.version.VersionException,
                          javax.jcr.RepositoryException
Removes the named version from this version history and automatically repairs the version graph. If the version to be removed is V, V's predecessor set is P and V's successor set is S, then the version graph is repaired s follows: Note that this change is made immediately; there is no need to call save. In fact, since the the version storage is read-only with respect to normal repository methods, save does not even function in this context. <p/> An AccessDeniedException will be thrown if the current Session does not have permission to remove the specified version. <p/> Throws an UnsupportedRepositoryOperationException if this operation is not supported by the implementation. <p/> Throws a VersionException if the named version is not in this VersionHistory.
Specified by:
removeVersion in interface javax.jcr.version.VersionHistory
Parameters:
versionName - the name of a version in this version history.
Throws:
javax.jcr.AccessDeniedException - if the current Session does not have permission to remove the specified version or if the specified version is currently the target of a REFERENCE property elsewhere in the repository (not just in this workspace) and the current Session does not have read access to that REFERENCE property.
javax.jcr.UnsupportedRepositoryOperationException - if this operation is not supported by the implementation.
javax.jcr.version.VersionException - if the named version is not in this version history.
javax.jcr.RepositoryException - if another error occurs.
javax.jcr.ReferentialIntegrityException

Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 1 (1.3)

E11993-02


Copyright © 2007, 2008, Oracle. All rights reserved.