@Override public Iterator<Resource> listChildren(Resource parent) { return parent.listChildren(); }
/** * Method for checking whether or not a resource has child resources. * * @param resource * the resource to check for child resources * @return true if the resource has child resources, false otherwise * @since 2.2.2 */ public static final boolean hasChildren(Resource resource) { return resource != null ? resource.listChildren().hasNext() : false; }
private ResourceDistributionPackageIterator(@NotNull Resource packagesRoot, @NotNull ResourceResolver resourceResolver, @NotNull String type) { this.packages = packagesRoot.listChildren(); this.resourceResolver = resourceResolver; this.type = type; }
@Override public int doEndTag() { log.trace("doEndTag"); log.debug("Listing the children of resource: " + resource); Iterator<Resource> children = null; if (resource != null) { children = resource.listChildren(); } log.debug("Saving to variable " + var); pageContext.setAttribute(var, children); return EVAL_PAGE; }
/** * Returns the value of calling <code>listChildren</code> on the * {@link #getResource() wrapped resource}. * * @since 2.1.0 (Sling API Bundle 2.1.0) */ @Override public Iterator<Resource> listChildren() { return getResource().listChildren(); }
@Override public boolean hasContents(final Resource resource, final int index) { final Resource parResource = resource.getChild(LONG_FORM_TEXT_PAR + index); return parResource != null && parResource.listChildren().hasNext(); }
/** * @see org.apache.sling.api.resource.AbstractResource#listChildren() */ @Override public Iterator<Resource> listChildren() { return this.getActiveResource().listChildren(); }
@Override public boolean hasContents(final Resource resource, final int index) { final Resource parResource = resource.getChild(LONG_FORM_TEXT_PAR + index); return parResource != null && parResource.listChildren().hasNext(); }
/** * Lists children using custom page iterator. * @param parentResource Parent resource * @param pageFilter Page filter * @return Page iterator */ protected final Iterator<Page> listChildren(Resource parentResource, PageFilter pageFilter) { return new PageIterator(parentResource.listChildren(), pageFilter); }
@Override public List<Resource> getNotifications(final SlingHttpServletRequest request, final Resource notificationsFolder) { final List<Resource> notifications = new ArrayList<Resource>(); final Iterator<Resource> itr = notificationsFolder.listChildren(); while (itr.hasNext()) { final Resource notification = itr.next(); if (this.isActiveNotification(request, notification)) { notifications.add(notification); } } return notifications; }
@Override public List<Entry> resolve(ResourceResolver resolver) { List<Entry> result = new LinkedList<>(); Iterator<Resource> it = resolver.getResource(HistoryImpl.ENTRY_PATH).listChildren(); while (it.hasNext()) { result.add(it.next().adaptTo(Entry.class)); } return result; } }, Collections.<Entry>emptyList());
private void search(Resource resource, Set<Page> pages, PageManager pageManager) { findReferencesInResource(resource, pages, pageManager); for (Iterator<Resource> iter = resource.listChildren(); iter.hasNext();) { search(iter.next(), pages, pageManager); } }
private void search(Resource resource, Set<Page> pages, PageManager pageManager) { findReferencesInResource(resource, pages, pageManager); for (Iterator<Resource> iter = resource.listChildren(); iter.hasNext();) { search(iter.next(), pages, pageManager); } }
@Override public List<Entry> resolve(ResourceResolver resolver) { List<Entry> result = new LinkedList<>(); Iterator<Resource> it = resolver.getResource(HistoryImpl.ENTRY_PATH).listChildren(); while (it.hasNext()) { result.add(it.next().adaptTo(Entry.class)); } return result; } }, Collections.<Entry>emptyList());
/** * Visit the given resource and all its descendants. * @param res The resource */ public void accept(final Resource res) { if (res != null) { this.visit(res); this.traverseChildren(res.listChildren()); } }
private List<Script> findAll(boolean skipIgnored, ResourceResolver resourceResolver) { List<Script> scripts = new LinkedList<>(); for (String path : getSearchPaths()) { Resource root = resourceResolver.getResource(path); if (root != null) { Iterator<Resource> children = root.listChildren(); scripts.addAll(getScripts(children, skipIgnored)); } } return scripts; }
public ResourceIterator(Resource root, String folderResourceType, boolean includeFolders, boolean includeLeafs) { this.folderResourceType = folderResourceType; this.includeFolders = includeFolders; this.includeLeafs = includeLeafs; this.rootPath = root.getPath(); currentFolder = root; currentIterator = currentFolder.listChildren(); next = seek(); }
private String getSlingScriptFolder(Resource resource) { Iterator<Resource> it = resource.getResourceResolver().getResource("/var/layoutswitcher").listChildren(); while ( it.hasNext()) { Resource r = it.next(); String path = r.getValueMap().get("path", String.class); if ( resource.getPath().startsWith(path)){ return r.getValueMap().get(SLING_SCRIPT_FOLDER, String.class); } } return null; }
private void processResource(Resource r) { if ("weretail/components/structure/product".equals(r.getResourceType())) { String productPath = r.getValueMap().get("productData", String.class); Resource product = r.getResourceResolver().getResource(productPath); log.info("Sling RequestWrapper {}", product.getPath()); children.add(mf.getModelFromWrappedRequest(request, product, ProductExporter.class)); } processChildren(r.listChildren()); }
public void init(Bindings bindings) { Resource resource = (Resource)bindings.get(SlingBindings.RESOURCE); ValueMap properties = (ValueMap)bindings.get(PROPERTIES); if (properties != null) { text = properties.get(TEXT, resource.getPath()); tag = properties.get(TAG, String.class); includeChildren = properties.get(INCLUDE_CHIDLREN, false); if (includeChildren) { children = resource.listChildren(); } } }