本文整理了Java中javax.jcr.Node.getReferences()
方法的一些代码示例,展示了Node.getReferences()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getReferences()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:getReferences
[英]This method returns all REFERENCE
properties that refer to this node and that are accessible through the current Session
. Equivalent to Node.getReferences(null)
.
If this node has no referring REFERENCE
properties, an empty iterator is returned. This includes the case where this node is not referenceable.
[中]此方法返回引用此节点的所有REFERENCE
属性,这些属性可通过当前[$1$]访问。相当于Node.getReferences(null)
。
如果此节点没有引用REFERENCE
属性,则返回一个空迭代器。这包括此节点不可引用的情况。
代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript
public Iterator<?> jsFunction_getReferences() {
try {
return node.getReferences();
} catch (RepositoryException re) {
return Collections.EMPTY_LIST.iterator();
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public PropertyIterator getReferences() throws RepositoryException {
return new PropertyIteratorDecorator(factory, session, node.getReferences());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public PropertyIterator getReferences() throws RepositoryException {
return getWrappedNode().getReferences();
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public PropertyIterator getReferences(String name) throws RepositoryException {
return getWrappedNode().getReferences(name);
}
代码示例来源:origin: org.drools/guvnor-repository
public void remove() {
try {
PropertyIterator pi = this.node.getReferences();
if ( pi.hasNext() ) {
throw new RulesRepositoryException( "The status still has some assets linked to it. You will need to remove the links so you can delete the status." );
}
this.node.remove();
} catch ( RepositoryException e ) {
log.error( "Unable to remove state item.", e );
}
}
}
代码示例来源:origin: org.fcrepo/fcrepo-kernel-modeshape
@SuppressWarnings("unchecked")
private static Stream<Property> getAllReferences(final Node node) throws RepositoryException {
return Stream.concat(iteratorToStream(node.getReferences()), iteratorToStream(node.getWeakReferences()));
}
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
public void remove() {
try {
PropertyIterator pi = this.node.getReferences();
if ( pi.hasNext() ) {
throw new RulesRepositoryException( "The status still has some assets linked to it. You will need to remove the links so you can delete the status." );
}
this.node.remove();
} catch ( RepositoryException e ) {
log.error( "Unable to remove state item.", e );
}
}
}
代码示例来源:origin: brix-cms/brix-cms
public JcrPropertyIterator execute() throws Exception {
return JcrPropertyIterator.Wrapper.wrap(getDelegate().getReferences(),
getJcrSession());
}
});
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public RemoteIterator getReferences()
throws RepositoryException, RemoteException {
try {
return getFactory().getRemotePropertyIterator(node.getReferences());
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public RemoteIterator getReferences(String name)
throws RepositoryException, RemoteException {
try {
return getFactory().getRemotePropertyIterator(node.getReferences(name));
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMultipleReferences1() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n0 = testRootNode.addNode(nodeName1, testNodeType);
n0.setProperty("myref0", ref);
Node n1 = testRootNode.addNode(nodeName3, testNodeType);
n1.setProperty("myref1", ref);
superuser.save();
checkReferences("refs", ref.getReferences("myref0"), n0.getPath() + "/myref0");
checkReferences("refs", ref.getReferences("myref1"), n1.getPath() + "/myref1");
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMultipleReferences() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n0 = testRootNode.addNode(nodeName1, testNodeType);
n0.setProperty("myref", ref);
Node n1 = testRootNode.addNode(nodeName3, testNodeType);
n1.setProperty("myref", ref);
superuser.save();
checkReferences("refs", ref.getReferences(), n0.getPath() + "/myref", n1.getPath() + "/myref");
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMultipleReferencesOnSameNode() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.setProperty("myref0", ref);
n.setProperty("myref1", ref);
superuser.save();
assertEquals("ref", ref.getPath(), n.getProperty("myref0").getNode().getPath());
assertEquals("ref", ref.getPath(), n.getProperty("myref1").getNode().getPath());
checkReferences("refs", ref.getReferences(), n.getPath() + "/myref0", n.getPath() + "/myref1");
}
代码示例来源:origin: org.fcrepo/fcrepo-kernel-modeshape
@SuppressWarnings("unchecked")
private static Stream<Property> getMembershipContext(final FedoraResource resource) throws RepositoryException {
return iteratorToStream(getJcrNode(resource).getReferences(LDP_MEMBER_RESOURCE))
.filter(UncheckedPredicate.uncheck((final Property p) -> {
final Node container = p.getParent();
return container.isNodeType(LDP_DIRECT_CONTAINER)
|| container.isNodeType(LDP_INDIRECT_CONTAINER);
}));
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMixedReferences() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n0 = testRootNode.addNode(nodeName1, testNodeType);
n0.setProperty("strong_reference", ref);
Node n1 = testRootNode.addNode(nodeName3, testNodeType);
n1.setProperty("weak_reference", superuser.getValueFactory().createValue(ref, true));
superuser.save();
checkReferences("refs", ref.getReferences(), n0.getPath() + "/strong_reference");
checkReferences("refs", ref.getWeakReferences(), n1.getPath() + "/weak_reference");
}
代码示例来源:origin: apache/jackrabbit-oak
public void testSimpleReferences() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.setProperty("myref", ref);
superuser.save();
assertEquals("ref", ref.getPath(), n.getProperty("myref").getNode().getPath());
checkReferences("refs", ref.getReferences(), n.getPath() + "/myref");
checkReferences("refs", ref.getWeakReferences());
}
代码示例来源:origin: apache/jackrabbit-oak
public void testMixedReferencesOnSameNode() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n0 = testRootNode.addNode(nodeName1, testNodeType);
n0.setProperty("strong_reference", ref);
n0.setProperty("weak_reference", superuser.getValueFactory().createValue(ref, true));
superuser.save();
checkReferences("refs", ref.getReferences(), n0.getPath() + "/strong_reference");
checkReferences("refs", ref.getWeakReferences(), n0.getPath() + "/weak_reference");
}
代码示例来源:origin: apache/jackrabbit-oak
private static Set<String> getReferencingPaths(Node n)
throws RepositoryException {
Set<String> refs = Sets.newHashSet();
PropertyIterator it = n.getReferences();
while (it.hasNext()) {
refs.add(it.nextProperty().getPath());
}
return refs;
}
}
代码示例来源:origin: apache/jackrabbit-oak
public void testSimpleWeakReferences() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.setProperty("myref", superuser.getValueFactory().createValue(ref, true));
superuser.save();
assertEquals("ref", ref.getPath(), n.getProperty("myref").getNode().getPath());
checkReferences("refs", ref.getReferences());
checkReferences("refs", ref.getWeakReferences(), n.getPath() + "/myref");
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getReferences() throws RepositoryException {
Session session = getAdminSession();
Node referee = getNode("/foo");
referee.addMixin("mix:referenceable");
getNode(TEST_PATH).setProperty("reference", session.getValueFactory().createValue(referee));
session.save();
PropertyIterator refs = referee.getReferences();
assertTrue(refs.hasNext());
Property p = refs.nextProperty();
assertEquals("reference", p.getName());
assertFalse(refs.hasNext());
}
内容来源于网络,如有侵权,请联系作者删除!