Package javax.jcr

Examples of javax.jcr.NodeIterator.nextNode()


    private int getChildCount(Node n) throws RepositoryException {
        int result = 0;
        final NodeIterator it = n.getNodes();
        while(it.hasNext()) {
            result++;
            final Node kid = it.nextNode();
            result += getChildCount(kid);
        }
        return result;
    }
   
View Full Code Here


                // get all child nodes of the demo content root node
                final NodeIterator nodes = root.getNodes();
                while (nodes.hasNext()) {

                    Node node = nodes.nextNode();
                    // for every child node, that has the correct properties set, create a POJO and add it to the list
                    if (node.hasProperty(PN_NOTETITLE) && node.hasProperty(PN_NOTETEXT)) {

                        final Note note = new Note();
                        note.setTitle(node.getProperty(PN_NOTETITLE).getString());
View Full Code Here

                public void remove() {
                    throw new UnsupportedOperationException();
                }

                public Resource next() {
                    Node next = nodes.nextNode();
                    try {
                        return new MockedResource(MockedResourceResolver.this,
                                next.getPath(), "nt:unstructured");
                    } catch (RepositoryException e) {
                        throw new RuntimeException("RepositoryException: " + e,
View Full Code Here

                return it.hasNext();
            }

            public JobStatus next() {
                try {
                    return jobStatusFactory.getJobStatus(it.nextNode());
                } catch(RepositoryException re) {
                    throw new JobStorageException("RepositoryException in next()", re);
                }
            }
View Full Code Here

                        public boolean hasNext() {
                            return nodes.hasNext();
                        }

                        public Resource next() {
                            Node node = nodes.nextNode();
                            try {
                                return new JcrNodeResource(resolver, node, null ,null);
                            } catch (RepositoryException e) {
                                throw new IllegalStateException(e);
                            }
View Full Code Here

    }

    public void cleanRepository() throws Exception {
        NodeIterator nodes = getSession().getRootNode().getNodes();
        while (nodes.hasNext()) {
            Node node = nodes.nextNode();
            if (!node.getDefinition().isProtected() && !node.getDefinition().isMandatory()) {
                try {
                    node.remove();
                } catch (RepositoryException e) {
                    log.error("Test clean repo: Cannot remove node: " + node.getPath(), e);
View Full Code Here

            }
            NodeIterator itr = res.getNodes(SlingPostConstants.CHUNK_NODE_NAME
                + "_" + String.valueOf(chunkOffset) + "*");
            if (itr.hasNext()) {
                throw new RepositoryException("Chunk already present at {"
                    + itr.nextNode().getPath() + "}");
            }
            String nodeName = SlingPostConstants.CHUNK_NODE_NAME + "_"
                + String.valueOf(chunkOffset) + "_"
                + String.valueOf(chunkOffset + value.getSize() - 1);
            if (totalLength == (currentLength + value.getSize())
View Full Code Here

                    changes.add(Modification.onModified(res.setProperty(
                        JCR_DATA, fileIns).getPath()));
                    NodeIterator nodeItr = res.getNodes(SlingPostConstants.CHUNK_NODE_NAME
                        + "*");
                    while (nodeItr.hasNext()) {
                        Node nodeRange = nodeItr.nextNode();
                        changes.add(Modification.onDeleted(nodeRange.getPath()));
                        nodeRange.remove();
                    }
                    if (res.hasProperty(SlingPostConstants.NT_SLING_FILE_LENGTH)) {
                        javax.jcr.Property expLenProp = res.getProperty(SlingPostConstants.NT_SLING_FILE_LENGTH);
View Full Code Here

            while (nodeItr.hasNext()) {
                if (nodeItr.getSize() > 1) {
                    throw new RepositoryException(
                        "more than one node found for pattern: " + startPattern);
                }
                Node rangeNode = nodeItr.nextNode();

                inpStrmSet.add(rangeNode.getProperty(
                    javax.jcr.Property.JCR_DATA).getBinary().getStream());
                log.debug("added chunk {} to merge stream", rangeNode.getName());
                String[] indexBounds = rangeNode.getName().substring(
View Full Code Here

        }
        if (chunkParent != null) {
            NodeIterator nodeItr = chunkParent.getNodes(SlingPostConstants.CHUNK_NODE_NAME
                + "*");
            while (nodeItr.hasNext()) {
                Node rangeNode = nodeItr.nextNode();
                rangeNode.remove();
            }
            if (chunkParent.hasProperty(SlingPostConstants.NT_SLING_FILE_LENGTH)) {
                chunkParent.getProperty(SlingPostConstants.NT_SLING_FILE_LENGTH).remove();
            }
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.