本文整理了Java中javax.jcr.Node.getVersionHistory()
方法的一些代码示例,展示了Node.getVersionHistory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getVersionHistory()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:getVersionHistory
[英]Returns the VersionHistory
object of this node. Under full versioning this object provides access to the nt:versionHistory
node holding this node's versions.
[中]返回此节点的VersionHistory
对象。在“完全版本控制”下,此对象提供对保存此节点版本的nt:versionHistory
节点的访问。
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public VersionHistory getVersionHistory() throws UnsupportedRepositoryOperationException, RepositoryException {
VersionHistory hist = node.getVersionHistory();
return factory.getVersionHistoryDecorator(session, hist);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if Node.checkin() adds another version to the VersionHistory
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testCheckinCreatesNewVersion() throws RepositoryException {
long initialNumberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory());
versionableNode.checkin();
long numberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory());
assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test if Node.checkin() adds another version to the VersionHistory
*
* @throws RepositoryException
*/
@SuppressWarnings("deprecation")
public void testCheckinCreatesNewVersion() throws RepositoryException {
long initialNumberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory());
versionableNode.checkin();
long numberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory());
assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1);
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public RemoteVersionHistory getVersionHistory()
throws RepositoryException, RemoteException {
try {
return getFactory().getRemoteVersionHistory(node.getVersionHistory());
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if <code>Version.getUUID()</code> returns the right UUID
*/
public void testGetUUID() throws Exception {
List<Value> successorValues = Arrays.asList(versionableNode.getVersionHistory().getRootVersion().getProperty(jcrSuccessors).getValues());
assertTrue("Version.getUUID() did not return the right UUID", successorValues.contains(superuser.getValueFactory().createValue(version)));
}
代码示例来源:origin: apache/jackrabbit-oak
public void testGetVersionHistoryFromNode() throws Exception {
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.addMixin(JcrConstants.MIX_VERSIONABLE);
superuser.save();
VersionHistory vh = n.getVersionHistory();
assertNotNull(vh);
}
代码示例来源:origin: apache/jackrabbit
/**
* Test that the initial base version after creation of a versionable node
* points to the root version.
*
* @throws javax.jcr.RepositoryException
*/
public void testInitialBaseVersionPointsToRootVersion() throws RepositoryException {
Version rV = versionableNode.getVersionHistory().getRootVersion();
Version bV = versionableNode.getBaseVersion();
assertTrue("After creation of a versionable node the node's baseVersion must point to the rootVersion in the version history.", rV.isSame(bV));
}
代码示例来源:origin: ModeShape/modeshape
@SuppressWarnings( "deprecation" )
protected VersionHistory versionHistory( Node node ) throws RepositoryException {
if (useDeprecatedApi()) return node.getVersionHistory();
return session.getWorkspace().getVersionManager().getVersionHistory(node.getPath());
}
代码示例来源:origin: pentaho/pentaho-platform
public Object doInJcr( final Session session ) throws RepositoryException {
Item item = session.getItem( absPath );
Assert.isTrue( item.isNode() );
Node node = ( (Node) item );
return node.getVersionHistory().getPath();
}
} );
代码示例来源:origin: apache/jackrabbit-oak
public void testRemoveAddMixVersionable1() throws Exception {
Node node = testRootNode.addNode(nodeName1);
node.addMixin(mixReferenceable);
node.addMixin(mixVersionable);
superuser.save();
String vhId = node.getVersionHistory().getUUID();
node.removeMixin(mixVersionable);
node.addMixin(mixVersionable);
superuser.save();
assertEquals(vhId, node.getVersionHistory().getUUID());
}
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testGetVersionHistory() throws Exception {
// accessing the version history must be allowed if the versionable node
// is readable to the editing test session.
Node testNode = testSession.getNode(versionablePath);
VersionHistory vh = testNode.getVersionHistory();
VersionHistory vh2 = testSession.getWorkspace().getVersionManager().getVersionHistory(versionablePath);
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testVersionHistoryGetIdentifier() throws Exception {
VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
testVh.getIdentifier();
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testVersionHistoryGetVersionableIdentifier() throws Exception {
VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
testVh.getVersionableIdentifier();
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testVersionHistoryGetVersionableUUID() throws Exception {
VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
testVh.getVersionableUUID();
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testGetAllVersions() throws Exception {
// accessing the version history must be allowed if the versionable node
// is readable to the editing test session.
Node testNode = testSession.getNode(versionablePath);
VersionHistory vh = testNode.getVersionHistory();
VersionIterator versionIterator = vh.getAllVersions();
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testGetAllLinearVersions() throws Exception {
// accessing the version history must be allowed if the versionable node
// is readable to the editing test session.
Node testNode = testSession.getNode(versionablePath);
VersionHistory vh = testNode.getVersionHistory();
VersionIterator versionIterator = vh.getAllLinearVersions();
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* @since oak
*/
@Test
public void testVersionablePath() throws Exception {
Node n = createVersionableNode(superuser.getNode(path));
VersionHistory vh = n.getVersionHistory();
Property versionablePath = vh.getProperty(superuser.getWorkspace().getName());
assertEquals(n.getPath(), versionablePath.getString());
}
代码示例来源:origin: apache/jackrabbit
public NodeIterator execute() throws Exception {
Node n = getNode();
Version v = getRandomVersion(true);
if (v != null) {
log.info(n.getPath() + ":" + v.getName());
n.getVersionHistory().removeVersion(v.getName());
}
return wrapWithIterator(n);
}
}
代码示例来源:origin: apache/jackrabbit
/**
* Returns the versionable node.
*/
public NodeIterator execute() throws Exception {
Node n = getNode();
String name = n.getBaseVersion().getName();
String label = getRandomText(3);
log.info(n.getPath() + ":" + name + " -> " + label);
n.getVersionHistory().addVersionLabel(name, label, true);
return wrapWithIterator(n);
}
}
代码示例来源:origin: pentaho/pentaho-platform
public Object doInJcr( final Session session ) throws RepositoryException {
Node fileNode = (Node) session.getItem( absPath );
VersionHistory versionHistory = fileNode.getVersionHistory();
VersionIterator versionIterator = versionHistory.getAllVersions();
int versionCount = 0;
while ( versionIterator.hasNext() ) {
versionIterator.nextVersion();
versionCount++;
}
return versionCount;
}
} );
内容来源于网络,如有侵权,请联系作者删除!