protected Iterator computeOutput()

in src/main/java/org/apache/sling/pipes/internal/RemovePipe.java [61:87]


    protected Iterator<Resource> computeOutput() {
        Resource resource = getInput();
        String parentPath = null;
        try {
            if (resource.adaptTo(Node.class) != null) {
                parentPath = removeTree(resource, filter);
            } else {
                Property property = resource.adaptTo(Property.class);
                if (property != null){
                    Node parent = property.getParent();
                    if (parent != null) {
                        parentPath = parent.getPath();
                        logger.info("removing property {}", property.getPath());
                        if (!isDryRun()){
                            property.remove();
                        }
                    }
                }
            }
            if (parentPath != null) {
                return Collections.singleton(resolver.getResource(parentPath)).iterator();
            }
        } catch (RepositoryException e) {
            logger.error("unable to remove given resource", e);
        }
        return Collections.emptyIterator();
    }