public Iterator<?> jsFunction_getReferences() { try { return node.getReferences(); } catch (RepositoryException re) { return Collections.EMPTY_LIST.iterator(); } }
/** * @inheritDoc */ public PropertyIterator getReferences() throws RepositoryException { return new PropertyIteratorDecorator(factory, session, node.getReferences()); }
@Override public PropertyIterator getReferences() throws RepositoryException { return getWrappedNode().getReferences(); }
@Override public PropertyIterator getReferences(String name) throws RepositoryException { return getWrappedNode().getReferences(name); }
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 ); } } }
@SuppressWarnings("unchecked") private static Stream<Property> getAllReferences(final Node node) throws RepositoryException { return Stream.concat(iteratorToStream(node.getReferences()), iteratorToStream(node.getWeakReferences())); } }
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 ); } } }
public JcrPropertyIterator execute() throws Exception { return JcrPropertyIterator.Wrapper.wrap(getDelegate().getReferences(), getJcrSession()); } });
/** {@inheritDoc} */ public RemoteIterator getReferences() throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getReferences()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
/** {@inheritDoc} */ public RemoteIterator getReferences(String name) throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getReferences(name)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
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"); }
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"); }
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"); }
@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); })); }
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"); }
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()); }
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"); }
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; } }
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"); }
@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()); }