@NotNull @Override public NodeBuilder setChildNode(@NotNull String name) { return setChildNode(name, EMPTY_NODE); }
@Nonnull @Override public NodeBuilder setChildNode(@Nonnull String name) { return setChildNode(name, EMPTY_NODE); }
/** * Replaces the current state of this builder with the given node state. * The base state remains unchanged. * * @param newState new state */ protected void set(NodeState newState) { if (parent == null) { // updating the base revision forces all sub-builders to refresh baseRevision = rootHead.setState(newState); } else { parent.setChildNode(name, newState); } }
/** * Replaces the current state of this builder with the given node state. * The base state remains unchanged. * * @param newState new state */ protected void set(NodeState newState) { if (parent == null) { // updating the base revision forces all sub-builders to refresh baseRevision = rootHead.setState(newState); } else { parent.setChildNode(name, newState); } }
@NotNull @Override public NodeBuilder child(@NotNull String name) { if (hasChildNode(name)) { return getChildNode(name); } else { return setChildNode(name); } }
@Nonnull @Override public NodeBuilder child(@Nonnull String name) { if (hasChildNode(name)) { return getChildNode(name); } else { return setChildNode(name); } }
@Override public boolean childNodeAdded(@NotNull String name, @NotNull NodeState after) { try { SegmentNodeState compacted = compact(after, canceller); if (compacted != null) { updated(); builder.setChildNode(name, compacted); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
@Override public boolean childNodeChanged(@NotNull String name, @NotNull NodeState before, @NotNull NodeState after) { try { SegmentNodeState compacted = compact(before, after, base.getChildNode(name), canceller); if (compacted != null) { updated(); builder.setChildNode(name, compacted); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
@Override public boolean childNodeAdded(@NotNull String name, @NotNull NodeState after) { try { SegmentNodeState segmentNodeState = new PersistingDiff(this, name, EMPTY_NODE).diff(EMPTY_NODE, after); if (segmentNodeState != null) { updated(); builder.setChildNode(name, segmentNodeState); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
@Override public boolean childNodeAdded(@NotNull String name, @NotNull NodeState after) { try { SegmentNodeState segmentNodeState = new PersistingDiff(this, name, EMPTY_NODE).diff(EMPTY_NODE, after); if (segmentNodeState != null) { updated(); builder.setChildNode(name, segmentNodeState); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
@Override public boolean childNodeChanged(@NotNull String name, @NotNull NodeState before, @NotNull NodeState after) { try { SegmentNodeState compacted = new PersistingDiff(this, name, base.getChildNode(name)).diff(before, after); if (compacted != null) { updated(); builder.setChildNode(name, compacted); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
@Override public boolean childNodeChanged(@NotNull String name, @NotNull NodeState before, @NotNull NodeState after) { try { SegmentNodeState compacted = new PersistingDiff(this, name, base.getChildNode(name)).diff(before, after); if (compacted != null) { updated(); builder.setChildNode(name, compacted); return true; } else { return false; } } catch (IOException e) { exception = e; return false; } }
/** * Sets the named subtree to the given state. To avoid running out * of memory with large change-sets, the implementation recursively * copies all properties and child nodes to this builder so that the * purge mechanism has a chance to periodically flush partial changes * to the underlying storage database. * * See also: OAK-1768 */ @Override @NotNull public NodeBuilder setChildNode(@NotNull String name, @NotNull NodeState state) { NodeBuilder builder = super.setChildNode(name, EMPTY_NODE); for (PropertyState property : state.getProperties()) { builder.setProperty(property); } for (ChildNodeEntry child : state.getChildNodeEntries()) { builder.setChildNode(child.getName(), child.getNodeState()); } return builder; }
/** * Sets the named subtree to the given state. To avoid running out * of memory with large change-sets, the implementation recursively * copies all properties and child nodes to this builder so that the * purge mechanism has a chance to periodically flush partial changes * to the underlying storage database. * * See also: OAK-1768 */ @Override @NotNull public NodeBuilder setChildNode(@NotNull String name, @NotNull NodeState state) { NodeBuilder builder = super.setChildNode(name, EMPTY_NODE); for (PropertyState property : state.getProperties()) { builder.setProperty(property); } for (ChildNodeEntry child : state.getChildNodeEntries()) { builder.setChildNode(child.getName(), child.getNodeState()); } return builder; }