return true; boolean filterIsParentOfTree = filterMatchesOrIsParent(treePath); boolean filterIsTree = childTrees.contains(filter); if (filterIsParentOfTree && filterIsTree) {
return true; boolean filterIsParentOfTree = filterMatchesOrIsParent(treePath); boolean filterIsTree = childTrees.contains(filter); if (filterIsParentOfTree && filterIsTree) {
private void handlePureMetadataChanges(TreeDifference treeDifference, Set<String> ignoreList) { Map<NodeRef, NodeRef> pureMetadataChanges = treeDifference.findPureMetadataChanges(); for (Map.Entry<NodeRef, NodeRef> e : pureMetadataChanges.entrySet()) { NodeRef newValue = e.getValue(); String treePath = newValue.path(); if (ignoreList.contains(treePath)) { continue; } ignoreList.add(treePath); if (!filterMatchesOrIsParent(treePath)) { continue;// filter doesn't apply to the changed tree } MutableTree leftTree = treeDifference.getLeftTree(); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } }
private void handlePureMetadataChanges(TreeDifference treeDifference, Set<String> ignoreList) { Map<NodeRef, NodeRef> pureMetadataChanges = treeDifference.findPureMetadataChanges(); for (Map.Entry<NodeRef, NodeRef> e : pureMetadataChanges.entrySet()) { NodeRef newValue = e.getValue(); String treePath = newValue.path(); if (ignoreList.contains(treePath)) { continue; } ignoreList.add(treePath); if (!filterMatchesOrIsParent(treePath)) { continue;// filter doesn't apply to the changed tree } MutableTree leftTree = treeDifference.getLeftTree(); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } }
/** * A renamed tree is recognized by checking if a tree on the right points to the same object * that a tree on the left that doesn't exist anymore on the right. * <p> * Left entries are the original ones, and right entries are the new ones. * </p> * * @param treeDifference * @param ignoreList */ private void handleRenames(TreeDifference treeDifference, Set<String> ignoreList) { final SortedMap<NodeRef, NodeRef> renames = treeDifference.findRenames(); for (Map.Entry<NodeRef, NodeRef> e : renames.entrySet()) { NodeRef oldValue = e.getKey(); NodeRef newValue = e.getValue(); String newPath = newValue.path(); if (ignoreList.contains(newPath)) { continue; } ignoreList.add(newPath); if (!filterMatchesOrIsParent(newPath)) { continue;// filter doesn't apply to the renamed tree as a whole } LOGGER.trace("Handling rename of {} as {}", oldValue.path(), newPath); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(oldValue.path()); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } }
/** * A renamed tree is recognized by checking if a tree on the right points to the same object * that a tree on the left that doesn't exist anymore on the right. * <p> * Left entries are the original ones, and right entries are the new ones. * </p> * * @param treeDifference * @param ignoreList */ private void handleRenames(TreeDifference treeDifference, Set<String> ignoreList) { final SortedMap<NodeRef, NodeRef> renames = treeDifference.findRenames(); for (Map.Entry<NodeRef, NodeRef> e : renames.entrySet()) { NodeRef oldValue = e.getKey(); NodeRef newValue = e.getValue(); String newPath = newValue.path(); if (ignoreList.contains(newPath)) { continue; } ignoreList.add(newPath); if (!filterMatchesOrIsParent(newPath)) { continue;// filter doesn't apply to the renamed tree as a whole } LOGGER.trace("Handling rename of {} as {}", oldValue.path(), newPath); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(oldValue.path()); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } }
private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } }
private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = RevObjectFactory.defaultInstance().createNode(ref.name(), newTree.getId(), ref.getMetadataId(), TYPE.TREE, null, null); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } }
private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } }
private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = RevObjectFactory.defaultInstance().createNode(ref.name(), newTree.getId(), ref.getMetadataId(), TYPE.TREE, null, null); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } }