本文整理汇总了Java中org.apache.sling.api.resource.Resource.listChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.listChildren方法的具体用法?Java Resource.listChildren怎么用?Java Resource.listChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.api.resource.Resource
的用法示例。
在下文中一共展示了Resource.listChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listChildren
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
@Override
public Iterator<Resource> listChildren(Resource parent) {
return parent.listChildren();
}
示例2: createCategory
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
public PatternCategoryModel createCategory(Resource resource, String patternsPath, String patternId, PatternCategoryModel parentCategory) throws IOException {
if (isFolder(resource)) {
final List<PatternCategoryModel> subCategories = Lists.newArrayList();
final List<PatternModel> patterns = Lists.newArrayList();
final PatternCategoryModel currentCategory = new PatternCategoryModel(resource, patternsPath, subCategories, patterns, parentCategory);
final Iterator<Resource> childResources = resource.listChildren();
while (childResources.hasNext()) {
updateSubCategoriesAndPatterns(childResources.next(), subCategories, patterns, currentCategory, patternsPath, patternId);
}
return currentCategory;
}
return null;
}
示例3: retrieveJsonDataFilesInFolder
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
private List<String> retrieveJsonDataFilesInFolder(Resource filesParentResource, String name) {
final List<String> patternJsonDataFiles = Lists.newArrayList();
final Iterator<Resource> children = filesParentResource.listChildren();
while (children.hasNext()) {
final Resource childResource = children.next();
final String childResourceName = childResource.getName();
if (StringUtils.startsWith(childResourceName, name) && StringUtils.endsWith(childResourceName, PatternLabConstants.DATA_EXT)) {
patternJsonDataFiles.add(childResourceName);
}
}
return patternJsonDataFiles;
}
示例4: constructCategories
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
private void constructCategories(Resource pageContentResource) throws IOException {
categories = Lists.newArrayList();
final ResourceResolver resourceResolver = pageContentResource.getResourceResolver();
final Resource patternsPathResource = resourceResolver.getResource(patternsPath);
final Iterator<Resource> appsIterator = patternsPathResource.listChildren();
while (appsIterator.hasNext()) {
final PatternCategoryModel category = patternCategoryFactory.createCategory(appsIterator.next(), patternsPath, patternId);
if (category != null && category.isValid()) {
categories.add(category);
}
}
}