/** * Wraps and returns the {@code Iterator} obtained by calling {@code listChildren} on the wrapped resource resolver. * * @param parent The {@link Resource Resource} whose children are requested. * @return a wrapped iterator obtained through the wrapped resource resolver */ @NotNull @Override public Iterator<Resource> listChildren(@NotNull Resource parent) { return new ResourceIteratorWrapper(this, wrapped.listChildren(parent)); }
/** * Returns an iterator on the direct child resources. * <p> * This method is implemented calling the * {@link ResourceResolver#listChildren(Resource)} method. * <p> * Implementations should not generally overwrite this method without * calling this base class implementation. */ public Iterator<Resource> listChildren() { return getResourceResolver().listChildren(this); }
/** * Returns an <code>Iterator</code> of {@link Resource} objects loaded from * the children of the given <code>Resource</code>. * <p> * This is a convenience method for * {@link ResourceResolver#listChildren(Resource)}. * * @param parent The {@link Resource Resource} whose children are requested. * @return An <code>Iterator</code> of {@link Resource} objects. * @throws NullPointerException If <code>parent</code> is <code>null</code>. * @throws IllegalStateException if the resource resolver has already been * closed}. * @throws org.apache.sling.api.SlingException If any error occurs acquiring * the child resource iterator. * @see ResourceResolver#listChildren(Resource) * @deprecated since 2.1.0, use {@link Resource#listChildren()} instead */ @Deprecated public static @NotNull Iterator<Resource> listChildren(@NotNull Resource parent) { // directly call the resource resolver to ensure the correct result return parent.getResourceResolver().listChildren(parent); }
private void buildResourceList(ResourceResolver resolver, Resource res, List<Resource> resources) throws RepositoryException { Node node = res.adaptTo(Node.class); if (!node.isNodeType(JcrConstants.NT_HIERARCHYNODE)) { return; } resources.add(res); for (Iterator<Resource> iter = resolver.listChildren(res); iter.hasNext();) { Resource resChild = iter.next(); buildResourceList(resolver, resChild, resources); } }
private void buildResourceList(ResourceResolver resolver, Resource res, List<Resource> resources) throws RepositoryException { Node node = res.adaptTo(Node.class); if (!node.isNodeType(JcrConstants.NT_HIERARCHYNODE)) { return; } resources.add(res); for (Iterator<Resource> iter = resolver.listChildren(res); iter.hasNext();) { Resource resChild = iter.next(); buildResourceList(resolver, resChild, resources); resChild = null; } }
@Override public Iterator<Page> listChildren(final Filter<Page> filter, final boolean deep) { Iterator<Resource> resources; if (deep) { resources = new DeepResourceIterator(resource); } else { resources = resource.getResourceResolver().listChildren(resource); } // return filtered page iterator return new PageIterator(resources, filter); }
name = this.scriptName.substring(pos + 1); final Iterator<Resource> children = resolver.listChildren(current); while (children.hasNext()) { final Resource child = children.next();
: null; Iterator<Resource> children = resolver.listChildren(current); while (children.hasNext()) { Resource child = children.next();