本文整理汇总了Java中org.apache.sling.api.resource.Resource.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getParent方法的具体用法?Java Resource.getParent怎么用?Java Resource.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.api.resource.Resource
的用法示例。
在下文中一共展示了Resource.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTemplatesPatterns
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
private List<PatternModel> getTemplatesPatterns(Resource resource, String patternsPath, String patternId,
List<String> templateNames) throws IOException {
List<PatternModel> templatesPatterns = Lists.newArrayList();
final Resource folderResource = resource.getParent();
final List<String> jsonDataFiles = retrieveJsonDataFilesInFolder(folderResource, StringUtils.substringBefore(resource.getName(), PatternLabConstants.HTML_EXT));
for (String templateName : templateNames) {
final List<String> templateDedicatedDataFiles = getTemplateDedicatedFiles(templateName, jsonDataFiles, templateNames);
if (CollectionUtils.isEmpty(templateDedicatedDataFiles)) {
templatesPatterns.add(new PatternModel(resource, patternsPath, patternId, StringUtils.EMPTY, templateName, this.resourceResolver));
} else {
for (String jsonDataFileName : templateDedicatedDataFiles) {
templatesPatterns.add(new PatternModel(resource, patternsPath, patternId, jsonDataFileName, templateName, this.resourceResolver));
}
}
}
return templatesPatterns;
}
示例2: loadConfigHierarchy
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
private void loadConfigHierarchy(final ComponentManager componentManager, final String resourceType)
throws Exception {
com.day.cq.wcm.api.components.Component component = componentManager.getComponent(resourceType);
if (component != null) {
if (!configCache.containsKey(component.getResourceType())) {
while (component != null) {
Resource configResource = component.getLocalResource(XK_CONFIG_RESOURCE_NAME);
if (configResource == null)
break;
Resource foundComponentResource = configResource.getParent();
if (!foundComponentResource.getPath().equals(component.getPath())) {
component = componentManager.getComponent(foundComponentResource.getPath());
}
Node node = configResource.adaptTo(Node.class);
Map<String, InertProperty> propsMap = getNodePropertiesMap(node, new HashMap<String, InertProperty>(), BLANK);
configMembers.put(component.getResourceType(), propsMap);
component = component.getSuperComponent();
}
configCache.put(component.getResourceType(), configMembers);
} else {
configMembers = configCache.get(component.getResourceType());
}
}
propNamesDeepCache = names(false);
}
示例3: getParent
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
@Override
public Resource getParent(Resource element) {
return element.getParent();
}