use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.
the class CompositeNodeStoreTest method resetOnMountedStore.
@Test
public void resetOnMountedStore() {
NodeBuilder rootBuilder = store.getRoot().builder();
NodeBuilder builder = rootBuilder.getChildNode("tmp");
builder.child("newChild");
store.reset(rootBuilder);
assertFalse("Newly added child should no longer be visible after reset", builder.getChildNode("tmp").hasChildNode("newChild"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.
the class CompositeNodeStoreTest method builderStateIsUpdatedBeforeMergeinMountedStore.
@Test
public void builderStateIsUpdatedBeforeMergeinMountedStore() throws Exception {
NodeBuilder builder = store.getRoot().getChildNode("tmp").builder();
builder.child("newChild");
assertTrue("Newly created node should be visible in the builder's node state", builder.hasChildNode("newChild"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.
the class CompositeNodeStoreTest method checkpoint.
@Test
public void checkpoint() throws Exception {
String checkpoint = store.checkpoint(TimeUnit.DAYS.toMillis(1));
assertNotNull("checkpoint reference is null", checkpoint);
// create a new child /new in the root store
NodeBuilder globalBuilder = globalStore.getRoot().builder();
globalBuilder.child("new");
globalStore.merge(globalBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// create a new child /tmp/new in the mounted store
NodeBuilder mountedBuilder = mountedStore.getRoot().builder();
mountedBuilder.getChildNode("tmp").child("new");
mountedStore.merge(mountedBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// create a new child /libs/mount/new in the deeply mounted store
NodeBuilder deepMountBuilder = deepMountedStore.getRoot().builder();
deepMountBuilder.getChildNode("libs").getChildNode("mount").child("new");
deepMountedStore.merge(deepMountBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
assertFalse("store incorrectly exposes child at /new", store.retrieve(checkpoint).hasChildNode("new"));
assertFalse("store incorrectly exposes child at /tmp/new", store.retrieve(checkpoint).getChildNode("tmp").hasChildNode("new"));
assertFalse("store incorrectly exposes child at /libs/mount/new", store.retrieve(checkpoint).getChildNode("libs").getChildNode("mount").hasChildNode("new"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.
the class NodeStateFacetsConfig method setMultiValued.
@Override
public synchronized void setMultiValued(String dimName, boolean v) {
super.setMultiValued(dimName, v);
if (v) {
NodeBuilder current = this.nodeBuilder;
for (String p : PathUtils.elements(dimName)) {
NodeBuilder child = current.child(p);
if (!child.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) {
child.setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME);
}
child.setProperty(MULTIVALUED, true);
current = child;
}
}
}
use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.
the class NodeStateFacetsConfig method readMVFacets.
private void readMVFacets(NodeBuilder current, String prefix) {
for (String childName : current.getChildNodeNames()) {
NodeBuilder child = current.child(childName);
super.setMultiValued(childName, child.getProperty(MULTIVALUED).getValue(Type.BOOLEAN));
if (prefix.length() > 0) {
super.setMultiValued(prefix + "/" + childName, child.getProperty(MULTIVALUED).getValue(Type.BOOLEAN));
readMVFacets(child, childName);
}
}
}
Aggregations