use of com.adobe.acs.commons.util.visitors.TreeFilteringResourceVisitor in project acs-aem-commons by Adobe-Consulting-Services.
the class FolderRelocator method validateAllAcls.
private void validateAllAcls(ActionManager step1) {
TreeFilteringResourceVisitor folderVisitor = new TreeFilteringResourceVisitor();
folderVisitor.setBreadthFirstMode();
folderVisitor.setResourceVisitor((resource, level) -> step1.deferredWithResolver(rr -> checkNodeAcls(rr, resource.getPath(), requiredFolderPrivileges)));
folderVisitor.setLeafVisitor((resource, level) -> step1.deferredWithResolver(rr -> checkNodeAcls(rr, resource.getPath(), requiredNodePrivileges)));
sourceToDestination.keySet().forEach(sourcePath -> beginStep(step1, sourcePath, folderVisitor));
}
use of com.adobe.acs.commons.util.visitors.TreeFilteringResourceVisitor in project acs-aem-commons by Adobe-Consulting-Services.
the class PageRelocator method validateAllAcls.
protected void validateAllAcls(ActionManager step1) {
SimpleFilteringResourceVisitor pageVisitor;
if (extensiveACLChecks) {
pageVisitor = new SimpleFilteringResourceVisitor();
pageVisitor.setLeafVisitor((resource, level) -> step1.deferredWithResolver(rr -> checkNodeAcls(rr, resource.getPath(), requiredPrivileges)));
} else {
pageVisitor = new TreeFilteringResourceVisitor(NameConstants.NT_PAGE);
}
pageVisitor.setBreadthFirstMode();
pageVisitor.setResourceVisitor((resource, level) -> step1.deferredWithResolver(rr -> checkNodeAcls(rr, resource.getPath(), requiredPrivileges)));
beginStep(step1, sourcePath, pageVisitor);
}
use of com.adobe.acs.commons.util.visitors.TreeFilteringResourceVisitor in project acs-aem-commons by Adobe-Consulting-Services.
the class PageRelocator method movePages.
protected void movePages(ActionManager step2) {
TreeFilteringResourceVisitor pageVisitor = new TreeFilteringResourceVisitor(NameConstants.NT_PAGE);
pageVisitor.setBreadthFirstMode();
pageVisitor.setResourceVisitor((resource, level) -> step2.deferredWithResolver(rr -> movePage(rr, resource.getPath())));
beginStep(step2, sourcePath, pageVisitor);
}
use of com.adobe.acs.commons.util.visitors.TreeFilteringResourceVisitor in project acs-aem-commons by Adobe-Consulting-Services.
the class AssetReport method evaluateStructure.
public void evaluateStructure(ActionManager manager) {
TreeFilteringResourceVisitor visitor = new TreeFilteringResourceVisitor();
visitor.setBreadthFirstMode();
visitor.setTraversalFilter(r -> visitor.isFolder(r) && getDepth(r.getPath()) < depthLimit);
visitor.setLeafVisitor((r, depth) -> {
if (isAsset(r)) {
tabulate(getParentPath(r.getPath()), Column.asset_count, 1);
assetList.add(r.getPath());
} else if (visitor.isFolder(r)) {
tabulate(getParentPath(r.getPath()), Column.subfolder_count, 1);
setValue(r.getPath(), Column.level, depth + 1);
folderList.add(r.getPath());
}
});
visitor.setResourceVisitor((r, depth) -> {
setValue(r.getPath(), Column.level, depth + 1);
tabulate(getParentPath(r.getPath()), Column.subfolder_count, 1);
});
manager.deferredWithResolver(rr -> visitor.accept(rr.getResource(baseFolder)));
}
use of com.adobe.acs.commons.util.visitors.TreeFilteringResourceVisitor in project acs-aem-commons by Adobe-Consulting-Services.
the class AssetReport method evaluateDeepStructure.
public void evaluateDeepStructure(ActionManager manager) {
folderList.stream().peek(folderList::remove).forEach(folder -> {
manager.deferredWithResolver(rr -> {
Actions.setCurrentItem(folder);
TreeFilteringResourceVisitor visitor = new TreeFilteringResourceVisitor();
visitor.setBreadthFirstMode();
visitor.setLeafVisitor((r, depth) -> {
if (isAsset(r)) {
tabulate(getParentPath(r.getPath()), Column.asset_count, 1);
assetList.add(r.getPath());
}
});
visitor.setResourceVisitor((r, depth) -> {
tabulate(getParentPath(r.getPath()), Column.subfolder_count, 1);
});
visitor.accept(rr.getResource(folder));
});
});
}
Aggregations