本文整理了Java中javax.jcr.version.Version.getNode()
方法的一些代码示例,展示了Version.getNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getNode()
方法的具体详情如下:
包路径:javax.jcr.version.Version
类名称:Version
方法名:getNode
暂无
代码示例来源:origin: pentaho/pentaho-platform
/**
* Returns the node as it was at the given version.
*
* @param version
* version to get
* @return node at version
*/
private static Node getNodeAtVersion( final PentahoJcrConstants pentahoJcrConstants, final Version version )
throws RepositoryException {
return version.getNode( pentahoJcrConstants.getJCR_FROZENNODE() );
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if <code>Version.getNode(String)</code> returns the right child
* Node
*/
public void testGetNode() throws Exception {
assertTrue("Version.getNode(String) does not return a sub-node of type nt:frozenNode", version.getNode(jcrFrozenNode).isNodeType(ntFrozenNode));
}
代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr
public JcrVersion(Version version) throws RepositoryException {
// storing node's properties into variables to reduce 'throws' for
// getters
Node frozen = version.getNode(JcrNT.FROZEN_NODE);
initVersion(frozen);
lastModified = version.getProperty("jcr:created").getDate().getTime();
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if the jcr:frozenUuid property has the correct type
* @throws Exception
*/
public void testFrozenUUID() throws Exception {
Property p = version.getNode(jcrFrozenNode).getProperty(jcrFrozenUuid);
assertEquals("jcr:fronzenUuid should be of type string", PropertyType.TYPENAME_STRING, PropertyType.nameFromValue(p.getType()));
}
}
代码示例来源:origin: openl-tablets/openl-tablets
public JcrVersion(Version version) throws RepositoryException {
// storing node's properties into variables to reduce 'throws' for
// getters
Node frozen = version.getNode(JcrNT.FROZEN_NODE);
initVersion(frozen);
lastModified = version.getProperty("jcr:created").getDate().getTime();
}
代码示例来源:origin: info.magnolia/magnolia-core
public VersionedNode(Version versionedNode, Node baseNode) throws PathNotFoundException, RepositoryException {
super(versionedNode.getNode(MgnlNodeType.JCR_FROZENNODE), new VersionedNodeContentDecorator());
((VersionedNodeContentDecorator) getContentDecorator()).setVersionedNode(this);
this.version = versionedNode;
this.baseNode = baseNode;
}
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Set frozen node of this version as working node.
*/
private void init() throws RepositoryException {
this.setNode(this.state.getNode(ItemType.JCR_FROZENNODE));
try {
if (!StringUtils.equalsIgnoreCase(this.state.getName(), VersionManager.ROOT_VERSION)) {
this.rule = VersionManager.getInstance().getUsedFilter(this.getJCRNode());
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
if (this.rule == null) {
log.info("failed to get filter used for creating this version, use open filter");
this.rule = new Rule();
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-addon-publication-workflow-frontend
handleVersion = handleIter.nextVersion();
if (!handleVersion.getName().equals("jcr:rootVersion")) {
variantIterator = handleVersion.getNode("jcr:frozenNode").getNodes();
break;
boolean match = true;
for (Map.Entry<String, String> entry : criteria.entrySet()) {
Node variant = version.getNode("jcr:frozenNode");
if (!variant.hasProperty(entry.getKey())
|| !variant.getProperty(entry.getKey()).getString().equals(entry.getValue())) {
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testUnwrap() throws Exception {
final Version version = mock(Version.class);
when(version.getNode(JcrConstants.JCR_FROZENNODE)).thenReturn(root);
final VersionedNode wrapper = new VersionedNode(version, root);
assertEquals(root, NodeUtil.unwrap(wrapper));
}
代码示例来源:origin: org.onehippo.cms7/hippo-addon-publication-workflow-frontend
Node content = variant.getNode("jcr:frozenNode");
if (content.hasProperty("hippostd:state")
&& "draft".equals(content.getProperty("hippostd:state").getString())) {
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
Node node = version.getNode("jcr:frozenNode");
Calendar nodeCreated = version.getProperty("jcr:created").getDate();
if (!node.hasProperty(HippoNodeType.HIPPO_PATHS)) {
代码示例来源:origin: info.magnolia/magnolia-core
for (Value v : unwrappedVersion.getNode(JcrConstants.JCR_FROZENNODE).getProperty("jcr:frozenMixinTypes").getValues()) {
mixins.add(v.getString());
代码示例来源:origin: apache/jackrabbit
/**
* Tests if after each checkin an additional node is returned in a result
* of a query.
*/
public void testCheckin() throws RepositoryException {
// current time
Calendar c = Calendar.getInstance();
Node n1 = testRootNode.addNode(nodeName1);
n1.setProperty(propertyName1, c);
n1.addMixin(mixVersionable);
testRootNode.save();
String statement = "//*[@" + propertyName1 + "=xs:dateTime('" +
n1.getProperty(propertyName1).getString() + "')]";
Node v1 = n1.checkin().getNode(jcrFrozenNode);
executeXPathQuery(statement, new Node[]{n1,v1});
n1.checkout();
Node v2 = n1.checkin().getNode(jcrFrozenNode);
executeXPathQuery(statement, new Node[]{n1,v1,v2});
n1.checkout();
Node v3 = n1.checkin().getNode(jcrFrozenNode);
executeXPathQuery(statement, new Node[]{n1,v1,v2,v3});
}
}
代码示例来源:origin: pentaho/pentaho-platform
Version[] mockVersionsList2 = { mockVersion };
when( mockVersion.getSuccessors() ).thenReturn( mockVersionsList, mockVersionsList2, null );
when( mockVersion.getNode( (String) anyObject() ) ).thenReturn( versionNode );
when( mockVersion.getName() ).thenReturn( versionName );
when( mockVersion.getCreated() ).thenReturn( cal );
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void createVersionedNode() throws Exception{
Node asset = JcrUtils.getOrCreateByPath("/bundlingtest/foo.png", "oak:Unstructured", "oak:Asset", s, false);
asset.addMixin(JcrConstants.MIX_VERSIONABLE);
Node content = asset.addNode("jcr:content", "oak:Unstructured");
content.addNode("metadata", "oak:Unstructured");
s.save();
VersionManager vm = s.getWorkspace().getVersionManager();
String assetPath = asset.getPath();
vm.checkin(assetPath);
String versionedPath = vm.getBaseVersion(assetPath).getNode("jcr:frozenNode").getPath();
//Both normal node and versioned nodes should be bundled
assertNull(getNodeDocument(concat(assetPath, "jcr:content")));
assertNull(getNodeDocument(concat(versionedPath, "jcr:content")));
}
代码示例来源:origin: apache/jackrabbit
/**
* Checks if jcr:deref works when dereferencing into the version storage.
*/
public void testDerefToVersionNode() throws RepositoryException {
Node referenced = testRootNode.addNode(nodeName1);
referenced.addMixin(mixVersionable);
testRootNode.save();
Version version = referenced.checkin();
Node referencedVersionNode = version.getNode(jcrFrozenNode);
Node referencer = testRootNode.addNode(nodeName2);
referencer.setProperty(propertyName1, referencedVersionNode);
testRootNode.save();
String query = "/" + testRoot + "/*[@" + propertyName1 +
"]/jcr:deref(@" + propertyName1 + ",'*')";
QueryManager qm = superuser.getWorkspace().getQueryManager();
Query q = qm.createQuery(query, Query.XPATH);
QueryResult qr = q.execute();
NodeIterator ni = qr.getNodes();
assertEquals("Must find one result in query", 1, ni.getSize());
while (ni.hasNext()) {
Node node = (Node) ni.next();
assertTrue(node.getProperty("jcr:frozenUuid").getString().equals(referenced.getUUID()));
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void sourceWorkspaceIsSavedForVersionInMetaData() throws Exception {
// GIVEN
prepareForTestNodesWithSameIdentifiers(websiteSession, usersSession, "test");
// WHEN
Version version = versionManager.getVersion(websiteSession.getNode("/test"), "1.0");
// THEN
assertThat(version.getNode(BaseVersionManager.SYSTEM_NODE), hasProperty(BaseVersionManager.SOURCE_WORKSPACE, RepositoryConstants.WEBSITE));
// WHEN
version = versionManager.getVersion(usersSession.getNode("/test"), "1.3");
// THEN
assertThat(version.getNode(BaseVersionManager.SYSTEM_NODE), hasProperty(BaseVersionManager.SOURCE_WORKSPACE, RepositoryConstants.USERS));
}
代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr
protected static Node getNode4Version(Node node, CommonVersion version) throws RepositoryException {
Node result = null;
VersionHistory vh = node.getVersionHistory();
VersionIterator vi = vh.getAllVersions();
while (vi.hasNext()) {
Version jcrVersion = vi.nextVersion();
if (NodeUtil.isRootVersion(jcrVersion)) {
// TODO Shall we add first (0) version? (It is marker like, no
// real values)
} else {
JcrVersion jvi = new JcrVersion(jcrVersion);
CommonVersionImpl cv = new CommonVersionImpl(jvi.getRevision());
if (cv.compareTo(version) == 0) {
result = jcrVersion.getNode(JcrNT.FROZEN_NODE);
break;
}
}
}
if (result == null) {
throw new RepositoryException("Cannot find version '" + version.getVersionName() + "'!");
}
return result;
}
代码示例来源:origin: openl-tablets/openl-tablets
protected static Node getNode4Version(Node node, CommonVersion version) throws RepositoryException {
Node result = null;
VersionHistory vh = node.getVersionHistory();
VersionIterator vi = vh.getAllVersions();
while (vi.hasNext()) {
Version jcrVersion = vi.nextVersion();
if (NodeUtil.isRootVersion(jcrVersion)) {
// TODO Shall we add first (0) version? (It is marker like, no
// real values)
} else {
JcrVersion jvi = new JcrVersion(jcrVersion);
CommonVersionImpl cv = new CommonVersionImpl(jvi.getRevision());
if (cv.compareTo(version) == 0) {
result = jcrVersion.getNode(JcrNT.FROZEN_NODE);
break;
}
}
}
if (result == null) {
throw new RepositoryException("Cannot find version '" + version.getVersionName() + "'!");
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!