/** * The cancellation only considers canceling the parent node, which corresponds * to the policy node. */ public int cancel(CancelableOperation other) throws RepositoryException { if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(parentId, tree.getName()); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); if (thisPath == null || otherPath == null) { return CANCEL_NONE; } if (thisPath.equals(otherPath)) { return CANCEL_BOTH; } return (thisPath.isDescendantOf(otherPath)) ? CANCEL_THIS : CANCEL_NONE; } return CANCEL_NONE; } }
private void populateTree(Tree tree, NodeEntry nodeEntry) throws RepositoryException { Iterator<PropertyEntry> pEntries = nodeEntry.getPropertyEntries(); while (pEntries.hasNext()) { PropertyState ps = pEntries.next().getPropertyState(); if (!NameConstants.JCR_PRIMARYTYPE.equals(ps.getName()) && !NameConstants.JCR_UUID.equals(ps.getName())) { if (ps.isMultiValued()) { tree.addProperty(ps.getParent().getNodeId(), ps.getName(), ps.getType(), ps.getValues()); } else { tree.addProperty(ps.getParent().getNodeId(), ps.getName(), ps.getType(), ps.getValue()); } } } Iterator<NodeEntry> nEntries = nodeEntry.getNodeEntries(); while (nEntries.hasNext()) { NodeEntry child = nEntries.next(); NodeState childState = child.getNodeState(); Tree childTree = tree.addChild(childState.getName(), childState.getNodeTypeName(), childState.getUniqueID()); populateTree(childTree, child); } }
private void populateTree(Tree tree, NodeEntry nodeEntry) throws RepositoryException { Iterator<PropertyEntry> pEntries = nodeEntry.getPropertyEntries(); while (pEntries.hasNext()) { PropertyState ps = pEntries.next().getPropertyState(); if (!NameConstants.JCR_PRIMARYTYPE.equals(ps.getName()) && !NameConstants.JCR_UUID.equals(ps.getName())) { if (ps.isMultiValued()) { tree.addProperty(ps.getParent().getNodeId(), ps.getName(), ps.getType(), ps.getValues()); } else { tree.addProperty(ps.getParent().getNodeId(), ps.getName(), ps.getType(), ps.getValue()); } } } Iterator<NodeEntry> nEntries = nodeEntry.getNodeEntries(); while (nEntries.hasNext()) { NodeEntry child = nEntries.next(); NodeState childState = child.getNodeState(); Tree childTree = tree.addChild(childState.getName(), childState.getNodeTypeName(), childState.getUniqueID()); populateTree(childTree, child); } }
/** * The cancellation only considers canceling the parent node, which corresponds * to the policy node. */ public int cancel(CancelableOperation other) throws RepositoryException { if (other instanceof Remove) { Path thisPath = ConsolidatingChangeLog.getPath(parentId, tree.getName()); Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId); if (thisPath == null || otherPath == null) { return CANCEL_NONE; } if (thisPath.equals(otherPath)) { return CANCEL_BOTH; } return (thisPath.isDescendantOf(otherPath)) ? CANCEL_THIS : CANCEL_NONE; } return CANCEL_NONE; } }
@Override public void setTree(NodeId parentId, Tree contentTree) throws RepositoryException { assertMethod(); if (!(contentTree instanceof JsonTree)) { throw new RepositoryException("Invalid Tree implementation : " + contentTree.getClass().getName()); } Path normalizedPath = getPathFactory().create(getPath(parentId, sessionInfo), contentTree.getName(), true); String jcrPath = getNamePathResolver(sessionInfo).getJCRPath(normalizedPath); appendDiff(SYMBOL_ADD_NODE, jcrPath, ((JsonTree) contentTree).toJsonString(parts, binaries)); }
@Override public void setTree(NodeId parentId, Tree contentTree) throws RepositoryException { assertMethod(); if (!(contentTree instanceof JsonTree)) { throw new RepositoryException("Invalid Tree implementation : " + contentTree.getClass().getName()); } Path normalizedPath = getPathFactory().create(getPath(parentId, sessionInfo), contentTree.getName(), true); String jcrPath = getNamePathResolver(sessionInfo).getJCRPath(normalizedPath); appendDiff(SYMBOL_ADD_NODE, jcrPath, ((JsonTree) contentTree).toJsonString(parts, binaries)); }