/**
   * Converts the resource type to an absolute path. If it does not start with "/" the resource is
   * resolved via search paths using resource resolver. If not matching resource is found it is
   * returned unchanged.
   *
   * @param resourceType Resource type
   * @return Absolute resource type
   */
  public static String makeAbsolute(String resourceType, ResourceResolver resourceResolver) {
    if (StringUtils.isEmpty(resourceType) || StringUtils.startsWith(resourceType, "/")) {
      return resourceType;
    }

    // first try to resolve path via component manager - because on publish instance the original
    // resource may not accessible
    ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class);
    if (componentManager != null) {
      Component component = componentManager.getComponent(resourceType);
      if (component != null) {
        return component.getPath();
      } else {
        return resourceType;
      }
    }

    // otherwise use resource resolver directly
    Resource resource = resourceResolver.getResource(resourceType);
    if (resource != null) {
      return resource.getPath();
    } else {
      return resourceType;
    }
  }
 @Override
 public Component getComponent(String s) {
   Component out = wrapped.getComponent(s);
   if (!isVisible(out)) {
     return null;
   }
   return out;
 }
 @Override
 public Component getComponentOfResource(Resource resource) {
   Component out = wrapped.getComponentOfResource(resource);
   if (!isVisible(out)) {
     return null;
   }
   return out;
 }
 @Override
 public Collection<Component> getComponents() {
   List<Component> out = new ArrayList<>(wrapped.getComponents());
   ListIterator<Component> componentListIterator = out.listIterator();
   while (componentListIterator.hasNext()) {
     Component component = componentListIterator.next();
     if (!isVisible(component)) {
       componentListIterator.remove();
     }
   }
   return out;
 }