private void restoreProperties( AbstractJcrNode sourceNode,
AbstractJcrNode targetNode ) throws RepositoryException {
Map<Name, Property> sourceProperties = new HashMap<Name, Property>();
Iterator<Property> iter = sourceNode.node().getProperties(cache);
while (iter.hasNext()) {
Property property = iter.next();
if (!IGNORED_PROP_NAMES_FOR_RESTORE.contains(property.getName())) {
sourceProperties.put(property.getName(), property);
}
}
MutableCachedNode mutable = targetNode.mutable();
SessionCache mutableCache = targetNode.session().cache();
PropertyIterator existingPropIter = targetNode.getProperties();
while (existingPropIter.hasNext()) {
AbstractJcrProperty jcrProp = (AbstractJcrProperty)existingPropIter.nextProperty();
Name propName = jcrProp.name();
Property prop = sourceProperties.remove(propName);
if (prop != null) {
// Overwrite the current property with the property from the version
mutable.setProperty(mutableCache, prop);
} else {
JcrPropertyDefinition propDefn = jcrProp.getDefinition();