use of org.apache.jackrabbit.oak.spi.commit.PartialConflictHandler.Resolution in project jackrabbit-oak by apache.
the class MergingNodeStateDiff method resolveConflict.
//------------------------------------------------------------< private >---
private void resolveConflict(ConflictType conflictType, NodeState conflictInfo) {
PropertyConflictHandler propertyConflictHandler = propertyConflictHandlers.get(conflictType);
if (propertyConflictHandler != null) {
for (PropertyState ours : conflictInfo.getProperties()) {
PropertyState theirs = parent.getProperty(ours.getName());
Resolution resolution = propertyConflictHandler.resolve(ours, theirs);
applyResolution(resolution, conflictType, ours);
}
} else {
NodeConflictHandler nodeConflictHandler = nodeConflictHandlers.get(conflictType);
if (nodeConflictHandler != null) {
for (ChildNodeEntry oursCNE : conflictInfo.getChildNodeEntries()) {
String name = oursCNE.getName();
NodeState ours = oursCNE.getNodeState();
NodeState theirs = parent.getChildNode(name);
Resolution resolution = nodeConflictHandler.resolve(name, ours, theirs);
applyResolution(resolution, conflictType, name, ours);
if (LOG.isDebugEnabled()) {
String diff = JsopDiff.diffToJsop(ours, theirs);
LOG.debug("{} resolved conflict of type {} with resolution {} on node {}, conflict trace {}", nodeConflictHandler, conflictType, resolution, name, diff);
}
}
} else {
LOG.warn("Ignoring unknown conflict '" + conflictType + '\'');
}
}
NodeBuilder conflictMarker = getConflictMarker(conflictType);
if (conflictMarker != null) {
assert conflictMarker.getChildNodeCount(1) == 0;
}
}
Aggregations