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(java.lang.String relPath)
Returns the value of calling
getChild on the
wrapped resource . |
java.lang.Iterable<Resource> |
getChildren()
Returns an iterable of the direct children of this resource.
|
java.lang.String |
getResourceType()
Returns the value of calling
getResourceType on the
wrapped resource . |
boolean |
hasChildren()
Returns the value of calling
hasChildren on the
wrapped resource . |
java.util.Iterator<Resource> |
listChildren()
Returns the value of calling
listChildren on the
wrapped resource . |
adaptTo, getName, getParent, getPath, getResource, getResourceMetadata, getResourceResolver, getResourceSuperType, getValueMap, isResourceType, toString
public FilteringResourceWrapper(@Nonnull Resource resource, @Nonnull ExpressionResolver expressionResolver, @Nonnull SlingHttpServletRequest request)
public Resource getChild(java.lang.String relPath)
ResourceWrapper
getChild
on the
wrapped resource
.getChild
in interface Resource
getChild
in class ResourceWrapper
relPath
- relative path to the child resourcenull
ResourceResolver.getResource(Resource, String)
public java.util.Iterator<Resource> listChildren()
ResourceWrapper
listChildren
on the
wrapped resource
.listChildren
in interface Resource
listChildren
in class ResourceWrapper
ResourceResolver.listChildren(Resource)
public java.lang.Iterable<Resource> getChildren()
Resource
This method is a convenience and returns exactly the same resources as
calling getResourceResolver().getChildren(resource)
.
getChildren
in interface Resource
getChildren
in class ResourceWrapper
Resource.getChildren()
public boolean hasChildren()
ResourceWrapper
hasChildren
on the
wrapped resource
.hasChildren
in interface Resource
hasChildren
in class ResourceWrapper
true
if the resource has any child resourcespublic java.lang.String getResourceType()
ResourceWrapper
getResourceType
on the
wrapped resource
.getResourceType
in interface Resource
getResourceType
in class ResourceWrapper
Copyright © 2010 - 2020 Adobe. All Rights Reserved