Class FilteringResourceWrapper

  • All Implemented Interfaces:
    Adaptable, Resource
    Direct Known Subclasses:
    WCMFilteringResourceWrapper

    public class FilteringResourceWrapper
    extends ResourceWrapper
    A ResourceWrapper that filters its descendant resources based on 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.