本文整理了Java中javax.jcr.Node.isSame()
方法的一些代码示例,展示了Node.isSame()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.isSame()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:isSame
暂无
代码示例来源:origin: apache/jackrabbit
protected void entering(Node n, int level)
throws RepositoryException {
if (!node.isSame(n)) {
descendants.add(n);
}
}
});
代码示例来源:origin: apache/jackrabbit
protected void entering(Node node, int level) throws RepositoryException {
if (node.getName().equals(name) && !testRootNode.isSame(node)) {
nodes.add(node);
}
}
});
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Orders the node first among its siblings.
*/
public static void orderFirst(Node node) throws RepositoryException {
Node parent = node.getParent();
NodeIterator siblings = parent.getNodes();
Node firstSibling = siblings.nextNode();
if (!firstSibling.isSame(node)) {
parent.orderBefore(node.getName(), firstSibling.getName());
}
}
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Returns true if both arguments represents the same node. In case the nodes are wrapped the comparison is done one
* the actual nodes behind the wrappers.
*/
public static boolean isSame(Node lhs, Node rhs) throws RepositoryException {
return unwrap(lhs).isSame(unwrap(rhs));
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-builtin
public Node getContainingFolder() throws RepositoryException {
Node jcrRoot = node.getSession().getRootNode();
Node parent = node.getParent();
while (!parent.isSame(jcrRoot)) {
if (parent.isNodeType(HippoNodeType.NT_DOCUMENT)) {
return parent;
}
parent = parent.getParent();
}
return null;
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if getParent() returns parent node
*/
public void testGetParent() throws RepositoryException {
assertTrue("getParent() of a property must return the parent node.",
testRootNode.isSame(property.getParent()));
}
代码示例来源:origin: apache/jackrabbit
/**
* Test the persistence of a property modified with an Node parameter and
* saved from the Session Requires a Node value (node)
*/
public void testNodeSession() throws RepositoryException, NotExecutableException {
property1.setValue(node);
superuser.save();
assertTrue("Reference property not saved", node.isSame(property1.getNode()));
}
代码示例来源:origin: apache/jackrabbit
/**
* <code>Node.getNode(".") </code> applied to the root node must return
* the same <code>Node</code> again.
*
* @throws RepositoryException
*/
public void testRootGetNodeDot() throws RepositoryException {
Node root = superuser.getRootNode();
assertTrue("Node.getNode(\".\") must return the same node", root.getNode(DOT).isSame(root));
}
代码示例来源:origin: pentaho/pentaho-platform
public Object doInJcr( final Session session ) throws RepositoryException, IOException {
PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
Node node = session.getNodeByIdentifier( id.toString() );
if ( !node.getParent().isSame( session.getRootNode() ) ) {
return toAcl( session, pentahoJcrConstants, node.getParent().getIdentifier() );
} else {
return null;
}
}
} );
代码示例来源:origin: apache/jackrabbit
/**
* Tests if getParent() returns parent node
*/
public void testGetParent()
throws NotExecutableException, RepositoryException {
if (childNode == null) {
throw new NotExecutableException("Workspace does not have sufficient content to run this test.");
}
assertTrue("getParent() of a child node return the parent node.",
testRootNode.isSame(childNode.getParent()));
}
代码示例来源:origin: org.onehippo.cms7.hst/hst-client
private static Node getHandleNodeIfIsAncestor(final Node currentNode, final Node rootNode) throws RepositoryException {
if (currentNode.isNodeType(HippoNodeType.NT_HANDLE)) {
return currentNode;
}
if (currentNode.isSame(rootNode)) {
return null;
}
return getHandleNodeIfIsAncestor(currentNode.getParent(), rootNode);
}
代码示例来源:origin: apache/jackrabbit
public void testShadowingItems() throws RepositoryException {
Node n = testRootNode.addNode(nodeName1, testNodeType);
Node n2 = testRootNode.addNode(nodeName2, testNodeType);
Property p = n.setProperty(propertyName1, "anyValue");
testRootNode.save();
testRootNode.getSession().move(n.getPath(), n2.getPath() + "/destination");
Node replaceNode = testRootNode.addNode(nodeName1, testNodeType);
Property replaceProp = replaceNode.setProperty(propertyName1, "anyValue");
assertFalse(replaceNode.isSame(n));
assertFalse(replaceProp.isSame(p));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSessionGetNode() throws Exception {
Node nn = superuser.getNode(n.getPath());
assertTrue(n.isSame(nn));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getNodeDot() throws RepositoryException {
Node node = getNode("/foo");
Node same = node.getNode(".");
assertNotNull(same);
assertEquals("foo", same.getName());
assertTrue(same.isSame(node));
}
代码示例来源:origin: ModeShape/modeshape
protected void verifyShare( Node original,
Node sharedNode ) throws RepositoryException {
// The identity, properties and children match the original node ...
assertThat(sharedNode.getIdentifier(), is(original.getIdentifier()));
assertThat(sharedNode.isSame(original), is(true));
assertSameProperties(sharedNode, original);
assertSameChildren(sharedNode, original);
// Verify the shared attributes ...
assertThat(sharedNode.isNodeType(MIX_SHAREABLE), is(true));
assertSharedSetIncludes(original, original.getPath(), sharedNode.getPath());
assertSharedSetIncludes(sharedNode, original.getPath(), sharedNode.getPath());
}
代码示例来源:origin: apache/jackrabbit
public void testTreeEntries() throws RepositoryException {
Item item = superuser.getItem(destinationPath + "/" + nodeName2);
assertTrue("Moving a node must move all child items as well.", childNode.isSame(item));
item = superuser.getItem(destinationPath + "/" + propertyName2);
assertTrue("Moving a node must move all child items as well.", childProperty.isSame(item));
item = superuser.getItem(destinationPath + "/" + nodeName2 + "/" + nodeName3);
assertTrue("Moving a node must move all child items as well.", grandChildNode.isSame(item));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getNodeDotDot() throws RepositoryException {
Node node = getNode("/foo");
Node root = node.getNode("..");
assertNotNull(root);
assertEquals("", root.getName());
assertTrue(root.isSame(node.getParent()));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testIsSame() throws Exception {
assertFalse(n.isSame(p));
assertFalse(p.isSame(n));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getNodeByIdentifier() throws RepositoryException {
Node node = getNode("/foo");
String id = node.getIdentifier();
Node node2 = getAdminSession().getNodeByIdentifier(id);
assertTrue(node.isSame(node2));
}
代码示例来源:origin: apache/jackrabbit
public void testParentChildLock2() throws Exception {
childNode.addMixin(mixLockable);
testRootNode.save();
try {
Lock l = childNode.lock(false, isSessionScoped());
assertTrue("child node must still hold lock", l.getNode().isSame(childNode));
} finally {
childNode.unlock();
}
}
内容来源于网络,如有侵权,请联系作者删除!