Package javax.jcr

Examples of javax.jcr.NodeIterator.nextNode()


        assertTrue(this.node1.hasNodes());
        assertFalse(this.node11.hasNodes());

        nodes = this.node1.getNodes("^node.*$");
        assertEquals(1, nodes.getSize());
        assertEquals(this.node11, nodes.nextNode());

        nodes = this.node1.getNodes("unknown?");
        assertEquals(0, nodes.getSize());
    }

View Full Code Here


        // Add all matching nodes to result
        try {
            NodeIterator it = node.getNodes(name);
            while (it.hasNext()) {
                items.add(ScriptRuntime.toObject(this, it.nextNode()));
            }
        } catch (RepositoryException e) {
            log.debug("RepositoryException while collecting Node children",e);
        }
View Full Code Here

                //do nothing, just do not list properties
            }
            try {
                NodeIterator nit = node.getNodes();
                while (nit.hasNext()) {
                    ids.add(nit.nextNode().getName());
                }
            } catch (RepositoryException e) {
                //do nothing, just do not list child nodes
            }
        }
View Full Code Here

            {
                List<Resource> childList = new ArrayList<Resource>();
                NodeIterator it = node.getNodes();
                while ( it.hasNext() )
                {
                    Node nextNode = it.nextNode();
                    childList.add( new TestResource( nextNode ) );
                }
                return childList.iterator();
            } catch ( RepositoryException re )
            {
View Full Code Here

            final Query q = s.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
            final NodeIterator it = q.execute().getNodes();
            assertTrue("Expecting a non-empty result", it.hasNext());
            boolean found = false;
            while(it.hasNext()) {
                if(it.nextNode().getPath().equals(absPath)) {
                    found = true;
                    break;
                }
            }
            assertTrue("Expecting test node " + absPath + " to be found", found);
View Full Code Here

  protected void renderChildNodes(PrintWriter pw, Node parent) throws RepositoryException {
    pw.println("<div class='childnodes'>");
    final String prefix = parent.getName() + "/";
    final NodeIterator it = parent.getNodes();
    while(it.hasNext()) {
      final Node kid = it.nextNode();
      pw.print("<a href='");
      pw.print(prefix);
      pw.print(kid.getName());
      pw.print("'>");
      pw.print(kid.getName());
View Full Code Here

    protected void readTree(PreferencesImpl prefs, Session session, Node node)
    throws RepositoryException {
        this.readPreferences(prefs, session, node);
        final NodeIterator iterator = node.getNodes();
        while ( iterator.hasNext() ) {
            final Node current = iterator.nextNode();
            final PreferencesImpl impl = (PreferencesImpl)prefs.node(current.getName());
            this.readTree(impl, session, current);
        }
    }
View Full Code Here

        try {
            try {
                final List<Long> bundleIds = new ArrayList<Long>();
                final NodeIterator iterator = session.getRootNode().getNodes(this.rootNodePath);
                while ( iterator.hasNext() ) {
                    final Node current = iterator.nextNode();
                    try {
                        final Long id = Long.valueOf(current.getName());
                        bundleIds.add(id);
                    } catch (NumberFormatException nfe) {
                        // we ignore this as this just indicates a wrong node in the tree
View Full Code Here

            // user preferences
            final String userPath = this.rootNodePath + '/' + bundleId + '/' + "users";
            if ( session.itemExists(userPath) ) {
                final NodeIterator iterator = ((Node)session.getItem(userPath)).getNodes();
                while ( iterator.hasNext() ) {
                    final Node current = iterator.nextNode();
                    final PreferencesDescription desc = new PreferencesDescription(bundleId, current.getName());
                    final PreferencesImpl root = new PreferencesImpl(desc, manager);

                    this.readTree(root, session, current);
View Full Code Here

    public void testIteration() throws Exception {
        String expect = "";
        NodeIterator iter = rootNode.getNodes();
        while (iter.hasNext()) {
            expect += iter.nextNode().getPath();
        }
        assertEquals(expect, freemarker.evalToString("<#list node as child>${child}</#list>"));
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.