@Override public boolean deleteResource(Path path) { return getDelegate().deleteResource(path); }
private Set<Resource<T>> listDirectoryIfFound(Path path) { if(getContentStorage(path).hasDirectory(path)){ return getContentStorage(path).listDirectory(path); } return null; }
@Override public Resource<T> createResource(Path path, T content) { return getDelegate().createResource(path, content); }
/** * Delete all resources and subdirectories of the given resource path * @param tree tree * @param path path * @return true if all resources were deleted successfully. */ public static boolean deletePathRecursive(Tree<ResourceMeta> tree, Path path){ if(tree.hasResource(path)) { //delete just this resource return tree.deleteResource(path); }else if (tree.hasDirectory(path)) { //list resources and delete Set<Resource<ResourceMeta>> resources = tree.listDirectory(path); boolean failed=false; for (Resource<ResourceMeta> resource : resources) { if(resource.isDirectory()){ if(!deletePathRecursive(tree,resource.getPath())){ failed=true; } }else { if(!tree.deleteResource(resource.getPath())){ failed=true; } } } return !failed; }else{ return true; } }
@Override public boolean hasDirectory(Path path) { return getDelegate().hasDirectory(path); }
@Override public boolean hasResource(Path path) { return getDelegate().hasResource(path); }
@Override public Set<Resource<T>> listDirectory(Path path) { return getDelegate().listDirectory(path); }
@Override public Set<Resource<T>> listDirectoryResources(Path path) { return getContentStorage(path).listDirectoryResources(path); }
@Override public Resource<T> getPath(Path path) { return getContentStorage(path).getPath(path); }
@Override public Resource<T> getResource(Path path) { return getDelegate().getResource(path); }
@Override public Resource<T> updateResource(Path path, T content) { return getContentStorage(path).updateResource(path, content); }
@Override public boolean hasPath(Path path) { return getContentStorage(path).hasPath(path); }
public boolean hasDirectory(Path path) { return getContentStorage(path).hasDirectory(path); } }
public boolean hasResource(Path path) { return getContentStorage(path).hasResource(path); }
@Override public Set<Resource<T>> listDirectoryResources(Path path) { return getDelegate().listDirectoryResources(path); }
@Override public Resource<T> getPath(Path path) { return getDelegate().getPath(path); }
@Override public Resource<T> getResource(Path path) { return getContentStorage(path).getResource(path); }
@Override public Resource<T> updateResource(Path path, T content) { return getDelegate().updateResource(path, content); }
@Override public boolean hasPath(Path path) { return getDelegate().hasPath(path); }
@Override public boolean deleteResource(Path path) { return getContentStorage(path).deleteResource(path); }