private void move(Fqn toMoveFqn, Fqn newParentFqn, boolean skipNotifications, InvocationContext ctx)
{
// the actual move algorithm.
// ctx *could* be null if this is a rollback!!! Sucks big time.
NodeSPI newParent = ctx == null ? dataContainer.peek(newParentFqn) : ctx.lookUpNode(newParentFqn);
if (newParent == null || newParent.isDeleted())
{
throw new NodeNotExistsException("New parent node " + newParentFqn + " does not exist when attempting to move node!!");
}
// ctx *could* be null if this is a rollback!!! Sucks big time.
NodeSPI node = ctx == null ? dataContainer.peek(toMoveFqn) : ctx.lookUpNode(toMoveFqn);
if (node == null || node.isDeleted())
{
throw new NodeNotExistsException("Node " + toMoveFqn + " does not exist when attempting to move node!!");
}
if (trace) log.trace("Moving " + fqn + " to sit under " + to);
NodeSPI oldParent = node.getParentDirect();
Object nodeName = toMoveFqn.getLastElement();
// now that we have the parent and target nodes:
// first correct the pointers at the pruning point
oldParent.removeChildDirect(nodeName);
newParent.addChild(nodeName, node);
// parent pointer is calculated on the fly using Fqns.
// notify
if (!skipNotifications)