}
}
private void mergeNodes() {
for (MongoNode committingNode : nodes.values()) {
MongoNode existingNode = existingNodes.get(committingNode.getPath());
if (existingNode != null) {
if(logger.isDebugEnabled()){
logger.debug("Found existing node to merge: {}", existingNode.getPath());
logger.debug("Existing node: {}", existingNode);
logger.debug("Committing node: {}", committingNode);
}
Map<String, Object> existingProperties = existingNode.getProperties();
if (!existingProperties.isEmpty()) {
committingNode.setProperties(existingProperties);
logger.debug("Merged properties for {}: {}", existingNode.getPath(),
existingProperties);
}
List<String> existingChildren = existingNode.getChildren();
if (existingChildren != null) {
committingNode.setChildren(existingChildren);
logger.debug("Merged children for {}: {}", existingNode.getPath(), existingChildren);
}
logger.debug("Merged node for {}: {}", existingNode.getPath(), committingNode);
} else {
// FIXME: this may also mean a node we modify has
// been removed in the meantime
}
}