* staged nodes into account.
*
* @param srcNode the source node.
*/
private void copy(MongoNode srcNode, String destPath) {
MongoNode destNode = srcNode.copy();
destNode.setPath(destPath);
destNode.removeField("_id");
copyAddedProperties(srcNode, destNode);
copyRemovedProperties(srcNode, destNode);
pathNodeMap.put(destPath, destNode);
List<String> children = new ArrayList<String>();
if (srcNode.getChildren() != null) {
children.addAll(srcNode.getChildren());
}
if (srcNode.getRemovedChildren() != null) {
for (String child : srcNode.getRemovedChildren()) {
destNode.removeChild(child);
children.remove(child);
}
}
if (srcNode.getAddedChildren() != null) {
for (String child : srcNode.getAddedChildren()) {
destNode.addChild(child);
children.add(child);
}
}
for (String child : children) {
String srcChildPath = PathUtils.concat(srcNode.getPath(), child);