Examples of NodeIterator


Examples of javax.jcr.NodeIterator

     * {@inheritDoc}
     */
    public Iterator<ChildInfo> getChildInfos(SessionInfo sessionInfo, NodeId parentId)
            throws ItemNotFoundException, RepositoryException {
        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        NodeIterator children = getNode(parentId, sInfo).getNodes();
        List<ChildInfo> childInfos = new ArrayList<ChildInfo>();
        try {
            while (children.hasNext()) {
                childInfos.add(new ChildInfoImpl(children.nextNode(),
                        sInfo.getNamePathResolver()));
            }
        } catch (NameException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of javax.jcr.NodeIterator

            throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return (Iterator<NodeId>) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                String nodePath = getNodePath(nodeId, sInfo);
                NodeIterator it = getVersionManager(sInfo).merge(nodePath, srcWorkspaceName, bestEffort);
                List<NodeId> ids = new ArrayList<NodeId>();
                while (it.hasNext()) {
                    ids.add(idFactory.createNodeId(it.nextNode()
                    ));
                }
                return ids.iterator();
            }
        }, sInfo);
View Full Code Here

Examples of javax.jcr.NodeIterator

            throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return (Iterator<NodeId>) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                String nodePath = getNodePath(nodeId, sInfo);
                NodeIterator it = getVersionManager(sInfo).merge(nodePath, srcWorkspaceName, bestEffort, isShallow);
                List<NodeId> ids = new ArrayList<NodeId>();
                while (it.hasNext()) {
                    ids.add(idFactory.createNodeId(it.nextNode()
                    ));
                }
                return ids.iterator();
            }
        }, sInfo);
View Full Code Here

Examples of javax.jcr.NodeIterator

    public Iterator<NodeId> mergeActivity(SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return (Iterator<NodeId>) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Node node = getNode(activityId, sInfo);
                NodeIterator it = getVersionManager(sInfo).merge(node);
                List<NodeId> ids = new ArrayList<NodeId>();
                while (it.hasNext()) {
                    ids.add(idFactory.createNodeId(it.nextNode()
                    ));
                }
                return ids.iterator();
            }
        }, sInfo);
View Full Code Here

Examples of javax.jcr.NodeIterator

        } catch (SAXException e) {
            throw new RepositoryException(e);
        }

        Node n = null;
        NodeIterator it = parent.getNodes(nodeName);
        while (it.hasNext()) {
            n = it.nextNode();
        }
        if (n == null) {
            throw new RepositoryException("Internal error: No child node added.");
        }
        return n;
View Full Code Here

Examples of javax.jcr.NodeIterator

    }

    public Iterator<Resource> listChildren(Resource parent) {
        try {
            Node node = parent.adaptTo(Node.class);
            final NodeIterator nodes = node.getNodes();
            return new Iterator<Resource>() {

                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,
                                e);
                    }
                }

                public boolean hasNext() {
                    return nodes.hasNext();
                }
            };
        } catch (RepositoryException e) {
            throw new RuntimeException("RepositoryException: " + e, e);
        }
View Full Code Here

Examples of javax.jcr.NodeIterator

        StringBuffer depth = new StringBuffer();
        for(int i=0; i<node.getDepth(); i++) {
            depth.append(" ");
        }
        logger.info(depth + "/" + node.getName() + " -- " + sb);
        NodeIterator it = node.getNodes();
        while (it.hasNext()) {
            Node child = it.nextNode();
            dump(child);
        }
    }
View Full Code Here

Examples of javax.jcr.NodeIterator

        if (remainingLevels<0) {
            // paranoia check
            throw new IllegalArgumentException("remainingLevels must be >=0, not: "+remainingLevels);
        }
        final long start = System.currentTimeMillis();
        NodeIterator nodes = node.getNodes();
        final long end = System.currentTimeMillis();
        log("ListTreeCommand.child -> "+node.getPath(), start, end);
        while (nodes.hasNext()) {
            Node childNode = nodes.nextNode();

            // TODO - this should not be needed if we obey the vlt filters
            if (childNode.getPath().equals("/jcr:system")) {
                continue;
            }
View Full Code Here

Examples of javax.jcr.NodeIterator

        Set<String> resourceChildNames = new HashSet<String>(children.size());
        Set<String> nodeChildNames = new HashSet<String>(children.size());

        List<Node> nodeChildren = new LinkedList<Node>();
        NodeIterator nodeChildrenIt = nodeToReorder.getNodes();
        while (nodeChildrenIt.hasNext()) {
            Node node = nodeChildrenIt.nextNode();
            nodeChildren.add(node);
            nodeChildNames.add(node.getName());
        }

        for (ResourceProxy childResources : children) {
View Full Code Here

Examples of javax.jcr.NodeIterator

        assertTrue(this.session.itemExists("/node1.ext/node12_ext"));

        assertEquals("value11", node11.getProperty("prop11").getString());
        assertEquals("value12", node12.getProperty("prop12").getString());

        NodeIterator nodes = node1.getNodes();
        assertEquals(2, nodes.getSize());
    }
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.