本文整理了Java中javax.jcr.Node.restore()
方法的一些代码示例,展示了Node.restore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.restore()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:restore
[英]Restores this
node to the state defined by the version with the specified versionName
.
This method will work regardless of whether this node is 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 restore
operation into the subgraph at this node. The result in such a case is governed by the removeExisting
flag. If removeExisting
is true
, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise a RepositoryException
is thrown). If removeExisting
is false
, then a ItemExistsException
is 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 have OnParentVersion
settings of COPY
or VERSION
are also governed by the removeExisting
flag.
[中]将this
节点还原到具有指定versionName
的版本定义的状态。
无论是否签入此节点,此方法都将起作用。
如果某个节点位于以该节点为根的子图之外,且其标识符与restore
操作将在此节点的子图中引入的节点相同,则会发生标识符冲突。这种情况下的结果由removeExisting
标志控制。如果removeExisting
为true
,则传入节点优先,并删除现有节点(及其子图)(如果可能;否则将抛出RepositoryException
)。如果removeExisting
是false
,则会抛出ItemExistsException
,并且不会进行任何更改。请注意,这不仅适用于还原节点本身与现有节点冲突的情况,也适用于与还原操作将引入工作区的任何节点发生冲突的情况。特别是,涉及还原节点的子节点的冲突,这些子节点的OnParentVersion
设置为COPY
或VERSION
也受removeExisting
标志控制。
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public void restore(String versionName, boolean removeExisting) throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
node.restore(versionName, removeExisting);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if restoring a node works on checked-out node.
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreOnCheckedOutNode() throws RepositoryException {
versionableNode.restore(version, true);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if restoring a node works on checked-out node.
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreOnCheckedOutNode() throws RepositoryException {
versionableNode.restore(version, true);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if restoring a node restores the correct property
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreCorrectProperty() throws RepositoryException {
versionableNode.restore(version, true);
String value = versionableNode.getProperty(propertyName1).getString();
assertEquals("Restoring a node must set the correct property.", propertyValue1, value);
}
代码示例来源:origin: nl.vpro/jcr-criteria
@Override
@Deprecated
public void restore(Version version, boolean removeExisting) throws RepositoryException {
getNode().restore(version, removeExisting);
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void restore(String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
getWrappedNode().restore(versionName, removeExisting);
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException, RepositoryException {
node.restore(VersionDecorator.unwrap(version), removeExisting);
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException,
ItemExistsException, VersionException, ConstraintViolationException,
UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
node.restore(VersionDecorator.unwrap(version), relPath, removeExisting);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if restoring a node works on checked-in node.
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreOnCheckedInNode() throws RepositoryException {
versionableNode.checkin();
versionableNode.restore(version, true);
}
代码示例来源:origin: nl.vpro/jcr-criteria
@Override
@Deprecated
public void restore(String versionName, boolean removeExisting) throws RepositoryException {
getNode().restore(versionName, removeExisting);
}
代码示例来源:origin: apache/jackrabbit
/**
* @see javax.jcr.version.VersionManager#restore(String, Version, boolean)
*/
public void restore(String absPath, Version version, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
session.checkIsAlive();
// get parent
int idx = absPath.lastIndexOf('/');
String parent = idx == 0 ? "/" : absPath.substring(0, idx);
String name = absPath.substring(idx + 1);
Node n = itemManager.getNode(resolver.getQPath(parent));
n.restore(version, name, removeExisting);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi
/**
* @see javax.jcr.version.VersionManager#restore(String, Version, boolean)
*/
public void restore(String absPath, Version version, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
session.checkIsAlive();
// get parent
int idx = absPath.lastIndexOf('/');
String parent = idx == 0 ? "/" : absPath.substring(0, idx);
String name = absPath.substring(idx + 1);
Node n = itemManager.getNode(resolver.getQPath(parent));
n.restore(version, name, removeExisting);
}
代码示例来源:origin: apache/jackrabbit
/**
* Restoring a node set the jcr:isCheckedOut property to false.
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreSetsIsCheckedOutToFalse() throws RepositoryException {
versionableNode.restore(version, true);
assertFalse("Restoring a node sets the jcr:isCheckedOut property to false", versionableNode.isCheckedOut());
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public void restore(String versionUUID, String path, boolean removeExisting)
throws RepositoryException, RemoteException {
try {
node.restore(getVersionByUUID(versionUUID), path, removeExisting);
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public void restoreByUUID(String versionUUID, boolean removeExisting)
throws RepositoryException, RemoteException {
try {
node.restore(getVersionByUUID(versionUUID), removeExisting);
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if restoring a node sets the jcr:baseVersion property correctly.
*
* @throws javax.jcr.RepositoryException
*/
@SuppressWarnings("deprecation")
public void testRestoreSetsBaseVersion() throws RepositoryException {
versionableNode.restore(version, true);
Version baseV = versionableNode.getBaseVersion();
assertTrue("Restoring a node must set node's base version in order to point to the restored version.", version.isSame(baseV));
}
代码示例来源:origin: apache/jackrabbit
/**
* @see javax.jcr.version.VersionManager#restore(String, String, boolean)
*/
public void restore(String absPath, String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
session.checkIsAlive();
Node n = itemManager.getNode(resolver.getQPath(absPath));
n.restore(versionName, removeExisting);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi
/**
* @see javax.jcr.version.VersionManager#restore(String, String, boolean)
*/
public void restore(String absPath, String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
session.checkIsAlive();
Node n = itemManager.getNode(resolver.getQPath(absPath));
n.restore(versionName, removeExisting);
}
代码示例来源:origin: brix-cms/brix-cms
/**
* @deprecated
*/
@Deprecated
public void restore(String versionName, boolean removeExisting) throws RepositoryException {
getActionHandler().beforeNodeRestoreVersion(this);
getDelegate().restore(versionName, removeExisting);
getActionHandler().afterNodeRestoreVersion(this);
}
代码示例来源:origin: ModeShape/modeshape
@SuppressWarnings( "deprecation" )
protected void restore( Node node,
Version version,
boolean removeExisting ) throws RepositoryException {
if (useDeprecatedApi()) {
node.restore(version, removeExisting);
} else {
session.getWorkspace().getVersionManager().restore(version, removeExisting);
}
}
内容来源于网络,如有侵权,请联系作者删除!