public class FilteringResourceWrapper extends ResourceWrapper
granite:hide BooleanEL property.
This wrapper needs to be applied to the container resource, such as the page root resource, and the dialog root resource.
It is also smart enough to handle include component. In that case, if the
resource type is granite/ui/components/coral/foundation/include, the
included resource will also be wrapped by this class, allowing the descendant
resources of the included resource to use granite:hide property.
For example given the following content structure:
+ /mycontainer
- sling:resourceType = "my/container"
+ item1
- sling:resourceType = "my/item"
+ item2
- sling:resourceType = "my/item"
- granite:hide = true
+ item3
- sling:resourceType = "my/item"
+ item4
- sling:resourceType = "granite/ui/components/coral/foundation/include"
- path = "/mycontainer2"
+ /mycontainer2
- sling:resourceType = "my/container2"
+ item1
- sling:resourceType = "my/item"
+ item2
- sling:resourceType = "my/item"
- granite:hide = true
Assuming that my/container resource type implementation uses
FilteringResourceWrapper to wrap its resource (/mycontainer
resource), /mycontainer/item2 and /mycontainer2/item2 will be
excluded during traversal transparently, as if they are not there in the
first place.
RESOURCE_TYPE_NON_EXISTING| Constructor and Description |
|---|
FilteringResourceWrapper(Resource resource,
ExpressionResolver expressionResolver,
SlingHttpServletRequest request) |
| Modifier and Type | Method and Description |
|---|---|
Resource |
getChild(String relPath)
Returns the value of calling
getChild on the
wrapped resource. |
Iterable<Resource> |
getChildren()
Returns an iterable of the direct children of this resource.
|
String |
getResourceType()
Returns the value of calling
getResourceType on the
wrapped resource. |
boolean |
hasChildren()
Returns the value of calling
hasChildren on the
wrapped resource. |
Iterator<Resource> |
listChildren()
Returns the value of calling
listChildren on the
wrapped resource. |
adaptTo, getName, getParent, getPath, getResource, getResourceMetadata, getResourceResolver, getResourceSuperType, getValueMap, isResourceType, toStringpublic FilteringResourceWrapper(@Nonnull Resource resource, @Nonnull ExpressionResolver expressionResolver, @Nonnull SlingHttpServletRequest request)
public Resource getChild(String relPath)
ResourceWrappergetChild on the
wrapped resource.getChild in interface ResourcegetChild in class ResourceWrapperrelPath - relative path to the child resourcenullResourceResolver.getResource(Resource, String)public Iterator<Resource> listChildren()
ResourceWrapperlistChildren on the
wrapped resource.listChildren in interface ResourcelistChildren in class ResourceWrapperResourceResolver.listChildren(Resource)public Iterable<Resource> getChildren()
Resource
This method is a convenience and returns exactly the same resources as
calling getResourceResolver().getChildren(resource).
getChildren in interface ResourcegetChildren in class ResourceWrapperResource.getChildren()public boolean hasChildren()
ResourceWrapperhasChildren on the
wrapped resource.hasChildren in interface ResourcehasChildren in class ResourceWrappertrue if the resource has any child resourcespublic String getResourceType()
ResourceWrappergetResourceType on the
wrapped resource.getResourceType in interface ResourcegetResourceType in class ResourceWrapperCopyright © 2010 - 2020 Adobe. All Rights Reserved