@Override @SuppressWarnings("unchecked") public synchronized Iterator<Property> iterator() { if (first) { first = false; return iterator; } else { try { return node.getWeakReferences(); } catch (RepositoryException e) { throw new RuntimeException(e); } } } };
@Override public PropertyIterator getWeakReferences() throws RepositoryException { PropertyIterator internal = delegate.getWeakReferences(); return new PropertyIteratorFacade(internal, session); }
@Override public PropertyIterator getWeakReferences(String name) throws RepositoryException { return getWrappedNode().getWeakReferences(name); }
@Override public PropertyIterator getWeakReferences(String name) throws RepositoryException { return getNode().getWeakReferences(name); }
@Override public PropertyIterator getWeakReferences(String name) throws RepositoryException { PropertyIterator internal = delegate.getWeakReferences(name); return new PropertyIteratorFacade(internal, session); }
@Override public PropertyIterator getWeakReferences() throws RepositoryException { return getNode().getWeakReferences(); }
@SuppressWarnings("unchecked") private static Stream<Property> getAllReferences(final Node node) throws RepositoryException { return Stream.concat(iteratorToStream(node.getReferences()), iteratorToStream(node.getWeakReferences())); } }
/** {@inheritDoc} */ public RemoteIterator getWeakReferences() throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getWeakReferences()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public JcrPropertyIterator execute() throws Exception { return JcrPropertyIterator.Wrapper.wrap(getDelegate().getWeakReferences(), getJcrSession()); } });
/** {@inheritDoc} */ public RemoteIterator getWeakReferences(String name) throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getWeakReferences(name)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public JcrPropertyIterator execute() throws Exception { return JcrPropertyIterator.Wrapper.wrap(getDelegate().getWeakReferences(name), getJcrSession()); } });
public void testSingleValueWithName() throws RepositoryException { Value weakRef = vf.createValue(target, true); referring.setProperty(propertyName1, weakRef); superuser.save(); PropertyIterator it = target.getWeakReferences(propertyName1); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
public void testMultiValues() throws RepositoryException { Value weakRef = vf.createValue(target, true); Value[] refs = new Value[]{weakRef, weakRef}; referring.setProperty(propertyName1, refs); superuser.save(); PropertyIterator it = target.getWeakReferences(); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
public void testMultiValuesWithName() throws RepositoryException { Value weakRef = vf.createValue(target, true); Value[] refs = new Value[]{weakRef, weakRef}; referring.setProperty(propertyName1, refs); superuser.save(); PropertyIterator it = target.getWeakReferences(propertyName1); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
public void testSingleValue() throws RepositoryException { Value weakRef = vf.createValue(target, true); referring.setProperty(propertyName1, weakRef); superuser.save(); PropertyIterator it = target.getWeakReferences(); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
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"); }
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 testMixedReferencesOnSameNode3() 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("mv_strong_reference", new Value[]{superuser.getValueFactory().createValue(ref, false)}); n0.setProperty("weak_reference", superuser.getValueFactory().createValue(ref, true)); n0.setProperty("mv_weak_reference", new Value[]{superuser.getValueFactory().createValue(ref, true)}); superuser.save(); checkReferences("refs", ref.getReferences(), n0.getPath() + "/strong_reference", n0.getPath() + "/mv_strong_reference"); checkReferences("refs", ref.getWeakReferences(), n0.getPath() + "/weak_reference", n0.getPath() + "/mv_weak_reference"); }
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"); }