org.apache.sling.api.resource.Resource.hasChildren()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.apache.sling.api.resource.Resource.hasChildren方法的一些代码示例,展示了Resource.hasChildren的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.hasChildren方法的具体详情如下:
包路径:org.apache.sling.api.resource.Resource
类名称:Resource
方法名:hasChildren

Resource.hasChildren介绍

[英]Checks if the resource has any child resources.
[中]检查资源是否有任何子资源。

代码示例

代码示例来源:origin: heervisscher/htl-examples

@Override
public boolean hasChildren() {
  return resource.hasChildren();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.api

/**
 * Returns the value of calling <code>hasChildren</code> on the
 * {@link #getResource() wrapped resource}.
 *
 * @since 2.4.4  (Sling API Bundle 2.5.0)
 */
@Override
public boolean hasChildren() {
  return getResource().hasChildren();
}

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

@PostConstruct
private void readErrors() {
  Resource failuresRoot = resource.getChild("failures");
  if (failuresRoot != null && failuresRoot.hasChildren()) {
    List<ArchivedProcessFailure> failures = new ArrayList<>();
    failuresRoot.getChildren().forEach(step->
        step.getChildren().forEach(f -> 
            failures.add(f.adaptTo(ArchivedProcessFailure.class))
        )
    );
    setReportedErrors(failures);
  }
}

代码示例来源:origin: Adobe-Marketing-Cloud/aem-guides

if (currentRes.hasChildren()) {
  buildList(currentRes);

代码示例来源:origin: nateyolles/publick-sling-blog

List<HashMap<String, Object>> comments = new ArrayList<HashMap<String, Object>>();
if (resource != null && resource.hasChildren()) {
  Iterator<Resource> iterator = resource.listChildren();

代码示例来源:origin: io.wcm/io.wcm.caconfig.extensions

if (item.hasChildren()) {
 for (Resource child : item.getChildren()) {
  if (isValidResourceCollectionItem(child)

代码示例来源:origin: org.apache.sling/org.apache.sling.distribution.core

if (res.hasChildren()) {
  continue;

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

private void movePageChildren(ResourceResolver rr, ResourceResolver res) throws MovingException {
    Resource source;
    source = rr.getResource(getSourcePath());
    try {
      if (source != null && source.hasChildren()) {
        for (Resource child : source.getChildren()) {
          if (!hasChild(child.getPath())) {
            String childDestination = child.getPath().replaceAll(getSourcePath(), getDestinationPath());
            String childDestinationParent = StringUtils.substringBeforeLast(childDestination, "/");
            if (!resourceExists(res, childDestination)) {
              waitUntilResourceFound(res, childDestinationParent);
              res.move(child.getPath(), childDestination);
            }
          }
        }
        res.commit();
      }
    } catch (PersistenceException e) {
      throw new MovingException(getSourcePath(), e);
    }
  }
}

相关文章