Hi all

Following an earlier discussion about storing a large number of nodes at
root, I am trying to move content nodes from root into a hierarchy
/documents/xx/yy/{id}

Hitting some issues:

1 - loop over all nodes in root,  move each content node

root.getChildNodeEntries().forEach(entry -> {
  NodeState nodeState = entry.getNodeState();

  if (isMyContentNode(nodeState)) {
     String name = entry.getName();

     // get or create parent folder
    NodeBuilder parent = getParent(name);

    NodeBuilder builder = rootBuilder.child(name);
    boolean result = builder.moveTo(parent, name);

    if (result)
      counter++;
    else
      logger.warn('not moved");
  }
});


after executing this with no warnings, all nodes are stil in the root
folder (inspected using oak-mongo.js)


2 - run garbage collection
nodeStore.getVersionGarbageCollector().gc(1, TimeUnit.SECONDS);

all nodes are still in the root




Questions:

1 - Is this the right approach to move nodes in the repository? Or should I
create a repository and use either Session.move or Workspace.move?


2 - how do I force old revisions out of root?

Thanks in advance

-- Alex






-- 
Alex Benenson

Reply via email to