Package javax.jcr

Examples of javax.jcr.NodeIterator


        }
    }

    public Object jsFunction_getNodes(String namePattern) {
        try {
            NodeIterator iter = null;
            if(namePattern == null || "undefined".equals(namePattern)) {
                iter = node.getNodes();
            } else {
                iter = node.getNodes(namePattern);
            }
View Full Code Here


        final List<Scriptable> items = new ArrayList<Scriptable>();

        // 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);
        }

        // Add all matching properties to result
        boolean isMulti = false;
        try {
            PropertyIterator it = node.getProperties(name);
            while (it.hasNext()) {
                Property prop = it.nextProperty();
                if (prop.getDefinition().isMultiple()) {
                    isMulti = true;
                    Value[] values = prop.getValues();
                    for (int i = 0; i < values.length; i++) {
                        items.add(wrap(values[i]));
View Full Code Here

                }
            } catch (RepositoryException e) {
                //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

        public Iterator<Resource> listChildren() {
            try
            {
                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 String stmt = "SELECT * FROM nt:base WHERE " + propName + " IS NOT NULL";

            @SuppressWarnings("deprecation")
            final Query q = s.getWorkspace().getQueryManager().createQuery(stmt, Query.SQL);

            final NodeIterator it = q.execute().getNodes();
            int count = 0;
            while(it.hasNext()) {
                it.next();
                count++;
            }
            assertEquals("Expected " + N_NODES + " result for query " + stmt, N_NODES, count);
        } finally {
            s.logout();
View Full Code Here

            s.save();

            final String statement = "/jcr:root//element(*, mix:title)";
            @SuppressWarnings("deprecation")
            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

     * Read the preferences from the repository.
     */
    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

        final Session session = this.checkInitialized();
        Long[] result = new Long[0];
        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

                this.readTree(root, session, rootNode);
            }
            // 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

TOP

Related Classes of javax.jcr.NodeIterator

Copyright © 2018 www.massapicom. 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.