Interface VersionManager
-
public interface VersionManagerTheVersionManagerobject is accessed viaWorkspace.getVersionManager(). It provides methods for:- Version graph functionality (version history, base version, successors predecessors)
- Basic version operations (checkin, checkout, checkpoint)
- Restore feature
- Label feature
- Merge feature
- Configuration feature
- Activity feature
- Since:
- JCR 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancelMerge(java.lang.String absPath, Version version)Cancels the merge process with respect to the node atabsPathand the specifiedversion.Versioncheckin(java.lang.String absPath)Creates for the versionable node atabsPatha new version with a system generated version name and returns that version (which will be the new base version of this node).voidcheckout(java.lang.String absPath)Sets the versionable node atabsPathto checked-out status by setting itsjcr:isCheckedOutproperty totrue.Versioncheckpoint(java.lang.String absPath)Performs acheckin()followed by acheckout()on the versionable node atabsPath.NodecreateActivity(java.lang.String title)This method creates a newnt:activityat an implementation-determined location in the/jcr:system/jcr:activitiessubgraph.NodecreateConfiguration(java.lang.String absPath)CallingcreateConfigurationon the node N atabsPathcreates, in the configuration storage, a newnt:configurationnode whose root is N.voiddoneMerge(java.lang.String absPath, Version version)Completes the merge process with respect to the node atabsPathand the specifiedversion.NodegetActivity()Returns the node representing the current activity ornullif there is no current activity.VersiongetBaseVersion(java.lang.String absPath)Returns the current base version of the versionable node atabsPath.VersionHistorygetVersionHistory(java.lang.String absPath)Returns theVersionHistoryobject of the node atabsPath.booleanisCheckedOut(java.lang.String absPath)Returnstrueif the node atabsPathis either versionable (full or simple) and currently checked-out, non-versionable and its nearest versionable ancestor is checked-out or non-versionable and it has no versionable ancestor.NodeIteratormerge(java.lang.String absPath, java.lang.String srcWorkspace, boolean bestEffort)This method recursively tests each versionable node in the subgraph of the node atabsPathagainst its corresponding node insrcWorkspacewith respect to the relation between their respective base versions and either updates the node in question or not, depending on the outcome of the test.NodeIteratormerge(java.lang.String absPath, java.lang.String srcWorkspace, boolean bestEffort, boolean isShallow)Same asmerge(String absPath, String srcWorkspace, boolean bestEffort)except that an option exists to make the merge shallow.NodeIteratormerge(Node activityNode)This method merges the changes that were made under the specified activity into the current workspace.voidremoveActivity(Node activityNode)This method removes the givenactivityNodeand allREFERENCEproperties within all workspaces that refer to theactivityNode.voidrestore(java.lang.String absPath, java.lang.String versionName, boolean removeExisting)Restores the node atabsPathto the state defined by the version with the specifiedversionName.voidrestore(java.lang.String absPath, Version version, boolean removeExisting)Restores the specified version toabsPath.voidrestore(Version[] versions, boolean removeExisting)Restores a set of versions at once.voidrestore(Version version, boolean removeExisting)Restores the node in the current workspace that is the versionable node of the specifiedversionto the state reflected in that version.voidrestoreByLabel(java.lang.String absPath, java.lang.String versionLabel, boolean removeExisting)Restores the version of the node atabsPathwith the specified version label.NodesetActivity(Node activity)This method is called by the client to set the current activity on the current session by specifying a previously creatednt:activitynode (seecreateActivity(java.lang.String)).
-
-
-
Method Detail
-
checkin
Version checkin(java.lang.String absPath) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException
Creates for the versionable node atabsPatha new version with a system generated version name and returns that version (which will be the new base version of this node). Sets thejcr:checkedOutproperty to false thus putting the node into the checked-in state. This means that the node and its connected non-versionable subgraph become read-only. A node's connected non-versionable subgraph is the set of non-versionable descendant nodes reachable from that node through child links without encountering any versionable nodes. In other words, the read-only status flows down from the checked-in node along every child link until either a versionable node is encountered or an item with no children is encountered. In a system that supports only simple versioning the connected non-versionable subgraph will be equivalent to the whole subgraph, since simple-versionable nodes cannot have simple-versionable descendants.Read-only status means that an item cannot be altered by the client using standard API methods (
addNode,setProperty, etc.). The only exceptions to this rule are therestore(javax.jcr.version.Version[], boolean)(all signatures),restoreByLabel(java.lang.String, java.lang.String, boolean),restore(javax.jcr.version.Version[], boolean),merge(java.lang.String, java.lang.String, boolean)andNode.update(java.lang.String)operations; these do not respect read-only status due to check-in. Note thatremoveof a read-only node is possible, as long as its parent is not read-only (since removal is an alteration of the parent node).If the node is already checked-in, this method has no effect but returns the current base version of the node at
absPath.If a repository supports configurations and baselines and the node at
absPathis a configuration proxy node in configuration storage then checkin of that node has the additional side effect of storing in the created version, the state of the configuration that this proxy node represents. In particular, the current bs version of each versionable node within the configuration is recorded in some implementation-specific way within the version created by the checkin. For checkin to succeed on a configuration proxy node, every versionable node within the configuration in question must have been checked-in at least once (i.e., each must have a current base version which is not the root version of its version history).If
checkinsucceeds, the change to thejcr:isCheckedOutproperty is dispatched immediately; there is no need to callsave.- Parameters:
absPath- an absolute path.- Returns:
- the created version.
- Throws:
VersionException- ifjcr:predecessorsdoes not contain at least one value or if a child item of the node atabsPathhas anOnParentVersionstatus ofABORT. This includes the case where an unresolved merge failure exists on the node, as indicated by the presence of ajcr:mergeFailedproperty.UnsupportedRepositoryOperationException- If the node atabsPathnode is not versionable.InvalidItemStateException- If unsaved changes exist on the node atabsPathor the node atabsPathis a configuration proxy node and the configuration it represents includes a versionabe node that has never been checked-in.LockException- if a lock prevents the operation.RepositoryException- If another error occurs.
-
checkout
void checkout(java.lang.String absPath) throws UnsupportedRepositoryOperationException, LockException, RepositoryExceptionSets the versionable node atabsPathto checked-out status by setting itsjcr:isCheckedOutproperty totrue. Under full versioning it also sets thejcr:predecessorsproperty to be a reference to the current base version (the same value as held injcr:baseVersion).This method puts the node into the checked-out state, making it and its connected non-versionable subgraph no longer read-only (see
checkin(String)for an explanation of the term "connected non-versionable subgraph". Under simple versioning this will simply be the whole subgraph).If successful, these changes are dispatched immediately; there is no need to call
save.If the node at
absPathis already checked-out, this method has no effect.- Parameters:
absPath- an absolute path.- Throws:
UnsupportedRepositoryOperationException- If the node atabsPathis not versionable.LockException- if a lock prevents the checkout.RepositoryException- If another error occurs.
-
checkpoint
Version checkpoint(java.lang.String absPath) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException
Performs acheckin()followed by acheckout()on the versionable node atabsPath.If the node is already checked-in, this method is equivalent to
checkout().- Parameters:
absPath- an absolute path.- Returns:
- the created version.
- Throws:
VersionException- if a child item of the node atabsPathhas anOnParentVersionofABORT. This includes the case where an unresolved merge failure exists on the node, as indicated by the presence of thejcr:mergeFailed.UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.InvalidItemStateException- if there are unsaved changes pending on the node atabsPath.LockException- if a lock prevents the operation.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
isCheckedOut
boolean isCheckedOut(java.lang.String absPath) throws RepositoryExceptionReturnstrueif the node atabsPathis either- versionable (full or simple) and currently checked-out,
- non-versionable and its nearest versionable ancestor is checked-out or
- non-versionable and it has no versionable ancestor.
Returns
falseif the node atabsPathis either- versionable (full or simple) and currently checked-in or
- non-versionable and its nearest versionable ancestor is checked-in.
- Parameters:
absPath- an absolute path.- Returns:
- a boolean
- Throws:
RepositoryException- If another error occurs.
-
getVersionHistory
VersionHistory getVersionHistory(java.lang.String absPath) throws UnsupportedRepositoryOperationException, RepositoryException
Returns theVersionHistoryobject of the node atabsPath. This object provides access to thent:versionHistorynode holding the node's versions.- Parameters:
absPath- an absolute path.- Returns:
- a
VersionHistoryobject - Throws:
UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.RepositoryException- If another error occurs.
-
getBaseVersion
Version getBaseVersion(java.lang.String absPath) throws UnsupportedRepositoryOperationException, RepositoryException
Returns the current base version of the versionable node atabsPath.- Parameters:
absPath- an absolute path.- Returns:
- a
Versionobject. - Throws:
UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.RepositoryException- If another error occurs.
-
restore
void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException
Restores a set of versions at once. Used in cases where a "chicken and egg" problem of mutually referringREFERENCEproperties would prevent the restore in any serial order.If the restore succeeds the changes made are dispatched immediately; there is no need to call
save.The following restrictions apply to the set of versions specified:
If
Sis the set of versions being restored simultaneously,- For every version
VinSthat corresponds to a missing node, there must also be a parent of V in S. Smust contain at least one version that corresponds to an existing node in the workspace.- No
VinScan be a root version (jcr:rootVersion).
If any of these restrictions does not hold, the restore will fail because the system will be unable to determine the path locations to which one or more versions are to be restored. In this case a
VersionExceptionis thrown.The versionable nodes in the current workspace that correspond to the versions being restored define a set of (one or more) subgraphs. An identifier collision occurs when the current workspace contains a node outside these subgraphs that has the same identifier as one of the nodes that would be introduced by the
restoreoperation into one of these subgraphs. The result in such a case is governed by theremoveExistingflag. IfremoveExistingistruethen the incoming node takes precedence, and the existing node (and its subgraph) is removed. IfremoveExistingisfalsethen aItemExistsExceptionis thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersionsettings ofCOPYorVERSIONare also governed by theremoveExistingflag.- Parameters:
versions- The set of versions to be restored.removeExisting- governs what happens on identifier collision.- Throws:
ItemExistsException- ifremoveExistingisfalseand an identifier collision occurs with a node being restored.UnsupportedRepositoryOperationException- if one or more of the nodes to be restored is not versionable.VersionException- if the set of versions to be restored is such that the original path location of one or more of the versions cannot be determined or if therestorewould change the state of a existing versionable node that is currently checked-in or if a root version (jcr:rootVersion) is among those being restored.LockException- if a lock prevents the restore.InvalidItemStateException- if thisSessionhas pending unsaved changes.RepositoryException- if another error occurs.
- For every version
-
restore
void restore(java.lang.String absPath, java.lang.String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryExceptionRestores the node atabsPathto the state defined by the version with the specifiedversionName.If the node at
absPathis not versionable, anUnsupportedRepositoryOperationExceptionis thrown.If successful, the change is dispatched immediately; there is no need to call
save. This method will work regardless of whether the node atabsPathis checked-in or not.An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restoreoperation into the subgraph at this node. The result in such a case is governed by theremoveExistingflag. IfremoveExistingistrue, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryExceptionis thrown). IfremoveExistingisfalse, then aItemExistsExceptionis thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersionsettings ofCOPYorVERSIONare also governed by theremoveExistingflag.- Parameters:
absPath- an absolute path.versionName- aVersionobjectremoveExisting- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.VersionException- if the specifiedversionis not part of this node's version history or if an attempt is made to restore the root version (jcr:rootVersion) or if no node exists atabsPath.ItemExistsException- ifremoveExistingisfalseand an identifier collision occurs.LockException- if a lock prevents the restore.InvalidItemStateException- if thisSession(not necessarily theNodeatabsPath) has pending unsaved changes.RepositoryException- If another error occurs.
-
restore
void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException
Restores the node in the current workspace that is the versionable node of the specifiedversionto the state reflected in that version.If successful, the change is dispatched immediately; there is no need to call
save. This method ignores checked-in status.An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restoreoperation into the subgraph at this node. The result in such a case is governed by theremoveExistingflag. IfremoveExistingistrue, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryExceptionis thrown). IfremoveExistingisfalse, then aItemExistsExceptionis thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersionsettings ofCOPYorVERSIONare also governed by theremoveExistingflag.- Parameters:
version- aVersionobjectremoveExisting- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException- if versioning is not supported.VersionException- if the specifiedversiondoes not have a corresponding node in the workspacethisVersionManager has been created for or if an attempt is made to restore the root version (jcr:rootVersion).ItemExistsException- ifremoveExistingisfalseand an identifier collision occurs.InvalidItemStateException- if thisSession(not necessarily theNodeatabsPath) has pending unsaved changes.LockException- if a lock prevents the restore.RepositoryException- if another error occurs.
-
restore
void restore(java.lang.String absPath, Version version, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryExceptionRestores the specified version toabsPath.There must be no existing node at
absPath. If one exists, aVersionExceptionis thrown.There must be a parent node to the location at
absPath, otherwise aPathNotFoundExceptionis thrown.An identifier collision occurs when a node exists outside the subgraph rooted at
absPathwith the same identifier as a node that would be introduced by therestoreoperation into the subgraph atabsPath. The result in such a case is governed by theremoveExistingflag. IfremoveExistingistrue, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryExceptionis thrown). IfremoveExistingisfalse, then aItemExistsExceptionis thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersionsettings ofCOPYorVERSIONare also governed by theremoveExistingflag.If the would-be parent of the location
absPathis actually a property, or if a node type restriction would be violated, then aConstraintViolationExceptionis thrown.If the
restoresucceeds, the changes made to this node are dispatched immediately; there is no need to callsave.- Parameters:
absPath- an absolute the path to which the version is to be restored.version- a version objectremoveExisting- covers what happens on identifier collision.- Throws:
PathNotFoundException- if the parent ofabsPathdoes not exist.ItemExistsException- if removeExisting is false and an identifier collision occursConstraintViolationException- If the would-be parent of the locationabsPathis actually a property, or if a node type restriction would be violatedVersionException- if the parent node ofabsPathis read-only due to a checked-in node or if a node exists atabsPathor if an attempt is made to restore the root version.UnsupportedRepositoryOperationException- if versioning is not supported.LockException- if a lock prevents the restore.InvalidItemStateException- if thisSession(not necessarily theNodeatabsPath) has pending unsaved changes.RepositoryException- if another error occurs
-
restoreByLabel
void restoreByLabel(java.lang.String absPath, java.lang.String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryExceptionRestores the version of the node atabsPathwith the specified version label. If successful, the change is dispatched immediately; there is no need to callsave.This method will work regardless of whether the node at
absPathis checked-in or not.An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restoreByLabeloperation into the subgraph at this node. The result in such a case is governed by theremoveExistingflag. IfremoveExistingistrue, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryExceptionis thrown). IfremoveExistingisfalse, then aItemExistsExceptionis thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersionsettings ofCOPYorVERSIONare also governed by theremoveExistingflag.- Parameters:
absPath- an absolute path.versionLabel- a StringremoveExisting- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.VersionException- if the specifiedversionLabeldoes not exist in this node's version history or if no node exists atabsPath.ItemExistsException- ifremoveExistingisfalseand an identifier collision occurs.LockException- if a lock prevents the restore.InvalidItemStateException- if thisSession(not necessarily theNodeatabsPath) has pending unsaved changes.RepositoryException- If another error occurs.
-
merge
NodeIterator merge(java.lang.String absPath, java.lang.String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException
This method recursively tests each versionable node in the subgraph of the node atabsPathagainst its corresponding node insrcWorkspacewith respect to the relation between their respective base versions and either updates the node in question or not, depending on the outcome of the test.When a versionable node V with base version B is encountered whose corresponding node V' has a base version B':
- If B' is an eventual predecessor of B then V is left unchanged.
- If B' is an eventual successor of B then V is updated to the state of V'.
- If B' and B are ob divergent branches of the version history then V fails the merge.
bestEffortistruethen each failed node is marked and traversal continues. IfbestEffortisfalsethen the first failed node results in aMergeException.This is a workspace-write method and therefore any changes are dispatched immediately; there is no need to call
save.This method returns a
NodeIteratorover all versionable nodes in the subgraph that received a merge result of fail. IfbestEffortisfalse, this iterator will be empty (since ifmergereturns successfully, instead of throwing an exception, it will be because no failures were encountered). IfbestEffortistrue, this iterator will contain all nodes that received a fail during the course of thismergeoperation.See the JCR specifications for more details on the behavior of this method.
- Parameters:
absPath- an absolute path.srcWorkspace- the name of the source workspace.bestEffort- a boolean- Returns:
- iterator over all nodes that received a merge result of "fail" in the course of this operation.
- Throws:
MergeException- ifbestEffortisfalseand a failed merge result is encountered.InvalidItemStateException- if this session (not necessarily the node atabsPath) has pending unsaved changes.NoSuchWorkspaceException- if the specifiedsrcWorkspacedoes not exist.AccessDeniedException- if the current session does not have sufficient rights to perform the operation.LockException- if a lock prevents the merge.RepositoryException- if another error occurs.
-
merge
NodeIterator merge(java.lang.String absPath, java.lang.String srcWorkspace, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException
Same asmerge(String absPath, String srcWorkspace, boolean bestEffort)except that an option exists to make the merge shallow.If
isShallowistrue, this method tests this versionable node against its corresponding node insrcWorkspacewith respect to the relation between their respective base versions and either updates the node in question or not, depending on the outcome of the test.If
isShallowisfalse, it recursively tests each versionable node in the subgraph as mentioned above. Seemerge(String absPath, String srcWorkspace, boolean bestEffort).If
isShallowistrueand this node is not versionable, then this method returns and no changes are made.If successful, the changes are dispatched immediately; there is no need to call
save.This method returns a
NodeIteratorover all versionable nodes in the subgraph that received a merge result of fail. IfbestEffortisfalse, this iterator will be empty (since ifmergereturns successfully, instead of throwing an exception, it will be because no failures were encountered). IfbestEffortistrue, this iterator will contain all nodes that received a fail during the course of thismergeoperation.- Parameters:
absPath- an absolute path.srcWorkspace- the name of the source workspace.bestEffort- a booleanisShallow- a boolean- Returns:
- iterator over all nodes that received a merge result of "fail" in the course of this operation.
- Throws:
MergeException- ifbestEffortisfalseand a failed merge result is encountered.InvalidItemStateException- if this session (not necessarily this node) has pending unsaved changes.NoSuchWorkspaceException- ifsrcWorkspacedoes not exist.AccessDeniedException- if the current session does not have sufficient rights to perform the operation.LockException- if a lock prevents the merge.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
doneMerge
void doneMerge(java.lang.String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryExceptionCompletes the merge process with respect to the node atabsPathand the specifiedversion.When the
merge(java.lang.String, java.lang.String, boolean)method is called on a node, every versionable node in that subgraph is compared with its corresponding node in the indicated other workspace and a "merge test result" is determined indicating one of the following:- This node will be updated to the state of its correspondee (if the base version of the correspondee is more recent in terms of version history)
- This node will be left alone (if this node's base version is more recent in terms of version history).
- This node will be marked as having failed the merge test (if this node's base version is on a different branch of the version history from the base version of its corresponding node in the other workspace, thus preventing an automatic determination of which is more recent).
(See
merge(java.lang.String, java.lang.String, boolean)for more details)In the last case the merge of the non-versionable subgraph (the "content") of this node must be done by the application (for example, by providing a merge tool for the user).
Additionally, once the content of the nodes has been merged, their version graph branches must also be merged. The JCR versioning system provides for this by keeping a record, for each versionable node that fails the merge test, of the base version of the corresponding node that caused the merge failure. This record is kept in the
jcr:mergeFailedproperty of this node. After amerge, this property will contain one or more (if multiple merges have been performed)REFERENCEs that point to the "offending versions".To complete the merge process, the client calls
doneMerge(Version v)passing the version object referred to be thejcr:mergeFailedproperty that the client wishes to connect tothisnode in the version graph. This has the effect of moving the reference to the indicated version from thejcr:mergeFailedproperty ofthisnode to thejcr:predecessors.If the client chooses not to connect this node to a particular version referenced in the
jcr:mergeFailedproperty, he callscancelMerge(String, Version). This has the effect of removing the reference to the specifiedversionfromjcr:mergeFailedwithout adding it tojcr:predecessors.Once the last reference in
jcr:mergeFailedhas been either moved tojcr:predecessors(withdoneMerge) or just removed fromjcr:mergeFailed(withcancelMerge) thejcr:mergeFailedproperty is automatically removed, thus enablingthisnode to be checked-in, creating a new version (note that before thejcr:mergeFailedis removed, itsOnParentVersionsetting ofABORTprevents checkin). This new version will have a predecessor connection to each version for whichdoneMergewas called, thus joining those branches of the version graph.If successful, these changes are dispatched immediately; there is no need to call
save.- Parameters:
absPath- an absolute path.version- a version referred to by thejcr:mergeFailedproperty of the node atabsPath.- Throws:
VersionException- if the version specified is not among those referenced in this node'sjcr:mergeFailedor if the node is currently checked-in.InvalidItemStateException- if there are unsaved changes pending on the node atabsPath.UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.RepositoryException- if another error occurs.
-
cancelMerge
void cancelMerge(java.lang.String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryExceptionCancels the merge process with respect to the node atabsPathand the specifiedversion.See
doneMerge(java.lang.String, javax.jcr.version.Version)for a full explanation. Also seemerge(java.lang.String, java.lang.String, boolean)for more details.If successful, these changes are dispatched immediately; there is no need to call
save.- Parameters:
absPath- an absolute path.version- a version referred to by thejcr:mergeFailedproperty of the node atabsPath.- Throws:
VersionException- if the version specified is not among those referenced in thejcr:mergeFailedproperty of the node atabsPathor if the node is currently checked-in.InvalidItemStateException- if there are unsaved changes pending on the node atabsPath.UnsupportedRepositoryOperationException- if the node atabsPathis not versionable.RepositoryException- if another error occurs.
-
createConfiguration
Node createConfiguration(java.lang.String absPath) throws UnsupportedRepositoryOperationException, RepositoryException
CallingcreateConfigurationon the node N atabsPathcreates, in the configuration storage, a newnt:configurationnode whose root is N. A reference to N is recorded in thejcr:rootproperty of the new configuration, and a reference to the new configuration is recorded in thejcr:configurationproperty of N.A new version history is created to store baselines of the new configuration, and the
jcr:baseVersionof the new configuration references the root version of the new version history.The changes are dispatched immediately; a
saveis not required.- Parameters:
absPath- an absolute path.- Returns:
- a new
nt:configurationnode - Throws:
UnsupportedRepositoryOperationException- if N is not versionable.RepositoryException- if no node exists atabsPathor another error occurs .- Since:
- JCR 2.0
-
setActivity
Node setActivity(Node activity) throws UnsupportedRepositoryOperationException, RepositoryException
This method is called by the client to set the current activity on the current session by specifying a previously creatednt:activitynode (seecreateActivity(java.lang.String)). Changing the current activity is done by callingsetActivityagain. Cancelling the current activity (so that the session has no current activity) is done by callingsetActivity(null). The previously setnt:activitynode is returned, ornullif no activity was previously set.- Parameters:
activity- an activity node- Returns:
- The previously set
nt:activitynode is returned, ornullif no activity was previously set. - Throws:
UnsupportedRepositoryOperationException- if the repository does not support activities or ifactivityis not ant:activitynode.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
getActivity
Node getActivity() throws UnsupportedRepositoryOperationException, RepositoryException
Returns the node representing the current activity ornullif there is no current activity.- Returns:
- An
nt:activitynode ornull. - Throws:
UnsupportedRepositoryOperationException- if the repository does not support activities.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
createActivity
Node createActivity(java.lang.String title) throws UnsupportedRepositoryOperationException, RepositoryException
This method creates a newnt:activityat an implementation-determined location in the/jcr:system/jcr:activitiessubgraph.The repository may, but is not required to, use the
titleas a hint for what to name the new activity node. The new activityNodeis returned.The new node addition is dispatched immediately and does not require a
save.- Parameters:
title- a String- Returns:
- the new activity
Node. - Throws:
UnsupportedRepositoryOperationException- if the repository does not support activities.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
removeActivity
void removeActivity(Node activityNode) throws UnsupportedRepositoryOperationException, VersionException, RepositoryException
This method removes the givenactivityNodeand allREFERENCEproperties within all workspaces that refer to theactivityNode. However, the existence of aREFERENCEto theactivityNodefrom within version storage will cause aVersionExceptionto be thrown.The change is dispatched immediately and does not require a
save.- Parameters:
activityNode- an activity Node.- Throws:
UnsupportedRepositoryOperationException- if the repository does not support activities.VersionException- if aREFERENCEto theactivityNodeexists in version storage.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
merge
NodeIterator merge(Node activityNode) throws VersionException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException
This method merges the changes that were made under the specified activity into the current workspace.An activity A will be associated with a set of versions through the
jcr:activityreference of each version node in the set. We call each such associated version a member of A.For each version history H that contains one or more members of A, one such member will be the latest member of A in H. The latest member of A in H is the version in H that is a member of A and that has no successor versions (to any degree) that are also members of A.
The set of versions that are the latest members of A in their respective version histories is called the change set of A. It fully describes the changes made under the activity A.
This method performs a shallow merge into the current workspace of each version in the change set of the activity specified by
activityNode. If there is no corresponding node in this workspace for a given member of the change set, that member is ignored.This method returns a
NodeIteratorover all versionable nodes in the subgraph that received a merge result of fail.The changes are dispatched immediately and do not require a
save.- Parameters:
activityNode- annt:activitynode- Returns:
- a
NodeIterator - Throws:
AccessDeniedException- if the current session does not have sufficient rights to perform the operation.VersionException- if the specified node is not annt:activitynode.MergeException- in the same cases as in a regular shallow merge (seemerge(String, String, boolean, boolean).LockException- if a lock prevents the merge.InvalidItemStateException- if thisSessionhas pending unsaved changes.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
-