Interface VersionHistory
-
-
Field Summary
-
Fields inherited from interface javax.jcr.Node
JCR_CHILD_NODE_DEFINITION, JCR_CONTENT, JCR_FROZEN_NODE, JCR_PROPERTY_DEFINITION, JCR_ROOT_VERSION, JCR_VERSION_LABELS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addVersionLabel(java.lang.String versionName, java.lang.String label, boolean moveLabel)
Adds the specified label to the specified version.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 version history in the same order asgetAllLinearVersions()
.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 thisVersionHistory
was accessed.VersionIterator
getAllVersions()
Returns an iterator over all the versions within this version history.Version
getRootVersion()
Returns the root version of this version history.Version
getVersion(java.lang.String versionName)
Retrieves a particular version from this version history by version name.java.lang.String
getVersionableIdentifier()
Returns the identifier of the versionable node for which this is the version history.java.lang.String
getVersionableUUID()
Deprecated.As of JCR 2.0,getVersionableIdentifier()
should be used instead.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(Version version)
Returns all version labels of the givenversion
- empty array if none.boolean
hasVersionLabel(java.lang.String label)
Returnstrue
if any version in the history has the givenlabel
.boolean
hasVersionLabel(Version version, java.lang.String label)
Returns true if the given version has the givenlabel
.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.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, isSame, refresh, remove, save
-
Methods inherited from interface javax.jcr.Node
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getBaseVersion, getCorrespondingNodePath, getDefinition, getIdentifier, getIndex, getLock, getMixinNodeTypes, getNode, getNodes, getNodes, getNodes, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperties, getProperty, getReferences, getReferences, getSharedSet, getUUID, getVersionHistory, getWeakReferences, getWeakReferences, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, isCheckedOut, isLocked, isNodeType, lock, merge, orderBefore, removeMixin, removeShare, removeSharedSet, restore, restore, restore, restoreByLabel, setPrimaryType, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock, update
-
-
-
-
Method Detail
-
getVersionableUUID
java.lang.String getVersionableUUID() throws RepositoryException
Deprecated.As of JCR 2.0,getVersionableIdentifier()
should be used instead.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.
-
getVersionableIdentifier
java.lang.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.- Since:
- JCR 2.0
-
getRootVersion
Version getRootVersion() throws RepositoryException
Returns the root version of this version history.- Returns:
- a
Version
object. - Throws:
RepositoryException
- if an error occurs.
-
getAllLinearVersions
VersionIterator getAllLinearVersions() throws RepositoryException
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 thisVersionHistory
was accessed.Within a version history
H
,B
is the base version bound to workspaceW
if and only if there exists a versionable nodeN
inW
whose version history isH
andB
is the base version ofN
.The line of descent from version
V1
toV2
, whereV2
is a successor ofV1
, is the ordered list of versions starting withV1
and proceeding through each direct successor toV2
.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.
-
getAllVersions
VersionIterator getAllVersions() throws RepositoryException
Returns an iterator over all the versions within this version history. If the version graph of this history is linear then the versions are returned in order of creation date, from oldest to newest. Otherwise the order of the returned versions is implementation-dependent.- Returns:
- a
VersionIterator
object. - Throws:
RepositoryException
- if an error occurs.
-
getAllLinearFrozenNodes
NodeIterator getAllLinearFrozenNodes() throws RepositoryException
This method returns all the frozen nodes of all the versions in this version history in the same order asgetAllLinearVersions()
.- Returns:
- a
NodeIterator
object. - Throws:
RepositoryException
- if an error occurs.- Since:
- JCR 2.0
-
getAllFrozenNodes
NodeIterator getAllFrozenNodes() throws RepositoryException
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.- Since:
- JCR 2.0
-
getVersion
Version getVersion(java.lang.String versionName) throws VersionException, RepositoryException
Retrieves a particular version from this version history by version name.- Parameters:
versionName
- a version name- Returns:
- a
Version
object. - Throws:
VersionException
- if the specified version is not in this version history.RepositoryException
- if an error occurs.
-
getVersionByLabel
Version getVersionByLabel(java.lang.String label) throws VersionException, RepositoryException
Retrieves a particular version from this version history by version label.- Parameters:
label
- a version label- Returns:
- a
Version
object. - Throws:
VersionException
- if the specifiedlabel
is not in this version history.RepositoryException
- if an error occurs.
-
addVersionLabel
void addVersionLabel(java.lang.String versionName, java.lang.String label, boolean moveLabel) throws LabelExistsVersionException, VersionException, RepositoryException
Adds the specified label to the specified version.The label must be a JCR name in either qualified or expanded form and therefore must conform to the syntax restriction that apply to such names. In particular a colon (":") should not be used unless it is intended as a prefix delimiter in a qualified name.
Adding a version label to a version corresponds to adding a reference property with a name specified by the
label
parameter to thejcr:versionLabels
sub node of thent:versionHistory
node. The reference property points to thent:version
node that represents the specified version.This is a workspace-write method and therefore the change is made immediately.
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
istrue
then the label is removed from its current location and added to the version with the specifiedversionName
. IfmoveLabel
isfalse
, then an attempt to add a label that already exists will fail.- Parameters:
versionName
- the name of the version to which the label is to be added.label
- the label to be added, A JCR name in either expanded or qualified form.moveLabel
- iftrue
, then iflabel
is already assigned to a version in this version history, it is moved to the new version specified; iffalse
, then attempting to assign an already used label will throw aLabelExistsVersionException
.- Throws:
LabelExistsVersionException
- ifmoveLabel
isfalse
, and an attempt is made to add a label that already exists in this version history.VersionException
- if the specified version does not exist in this version history or if the specified version is the root version (jcr:rootVersion
).RepositoryException
- if another error occurs.
-
removeVersionLabel
void removeVersionLabel(java.lang.String label) throws VersionException, RepositoryException
Removes the specified label from among the labels of this version history. The label must be a JCR name in either qualified or expanded form. This corresponds to removing a property from thejcr:versionLabels
child node of thent:versionHistory
node that represents this version history.This is workspace-write method and therefore the change is made immediately.
- Parameters:
label
- a version label. A JCR name in either expanded or qualified form.- Throws:
VersionException
- if the name label does not exist in this version history.RepositoryException
- if another error occurs.
-
hasVersionLabel
boolean hasVersionLabel(java.lang.String label) throws RepositoryException
Returnstrue
if any version in the history has the givenlabel
. The label must be a JCR name in either qualified or expanded form.- Parameters:
label
- a version label. A JCR name in either expanded or qualified form.- Returns:
- a
boolean
. - Throws:
RepositoryException
- if an error occurs.
-
hasVersionLabel
boolean hasVersionLabel(Version version, java.lang.String label) throws VersionException, RepositoryException
Returns true if the given version has the givenlabel
. The label must be a JCR name in either qualified or expanded form.- Parameters:
version
- a Version objectlabel
- a version label. A JCR name in either expanded or qualified form.- Returns:
- a
boolean
. - Throws:
VersionException
- if the specifiedversion
is not of this version history.RepositoryException
- if another error occurs.
-
getVersionLabels
java.lang.String[] getVersionLabels() throws RepositoryException
Returns all version labels of the history or an empty array if there are none.- Returns:
- a
String
array containing all the labels of the version history. - Throws:
RepositoryException
- if an error occurs.
-
getVersionLabels
java.lang.String[] getVersionLabels(Version version) throws VersionException, RepositoryException
Returns all version labels of the givenversion
- empty array if none. Throws aVersionException
if the specifiedversion
is not in this version history.- Parameters:
version
- a Version object- Returns:
- a
String
array containing all the labels of the given version - Throws:
VersionException
- if the specifiedversion
is not in this version history.RepositoryException
- if another error occurs.
-
removeVersion
void removeVersion(java.lang.String versionName) throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException
Removes the named version from this version history and automatically repairs the version graph. If the version to be removed isV
,V
's predecessor set isP
andV
's successor set isS
, then the version graph is repaired s follows:- For each member of
P
, remove the reference toV
from its successor list and add references to each member ofS
. - For each member of
S
, remove the reference toV
from its predecessor list and add references to each member ofP
.
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.- Parameters:
versionName
- the name of a version in this version history.- Throws:
ReferentialIntegrityException
- if the specified version is currently the target of aREFERENCE
property elsewhere in the repository (not necessarily in this workspace) and the currentSession
has read access to thatREFERENCE
property.AccessDeniedException
- if the current Session does not have permission to remove the specified version or if the specified version is currently the target of aREFERENCE
property elsewhere in the repository (not just in this workspace) and the currentSession
does not have read access to thatREFERENCE
property.UnsupportedRepositoryOperationException
- if this operation is not supported by the implementation.VersionException
- if the named version is not in this version history.RepositoryException
- if another error occurs.
- For each member of
-
-