use of org.apache.jackrabbit.oak.spi.state.ConflictType in project jackrabbit-oak by apache.
the class ConflictValidator method getConflictMessage.
private String getConflictMessage() {
StringBuilder sb = new StringBuilder("Commit failed due to unresolved conflicts in ");
sb.append(path);
sb.append(" = {");
for (ChildNodeEntry conflict : after.getChildNode(NodeTypeConstants.REP_OURS).getChildNodeEntries()) {
ConflictType ct = ConflictType.fromName(conflict.getName());
NodeState node = conflict.getNodeState();
sb.append(ct.getName()).append(" = {");
if (ct.effectsNode()) {
sb.append(getChildNodeNamesAsString(node));
} else {
for (PropertyState ps : node.getProperties()) {
PropertyState ours = null, theirs = null;
switch(ct) {
case DELETE_CHANGED_PROPERTY:
ours = null;
theirs = ps;
break;
case ADD_EXISTING_PROPERTY:
case CHANGE_CHANGED_PROPERTY:
ours = ps;
theirs = after.getProperty(ps.getName());
break;
case CHANGE_DELETED_PROPERTY:
ours = ps;
theirs = null;
break;
}
sb.append(ps.getName()).append(" = {").append(toString(ours)).append(',').append(toString(theirs)).append('}');
sb.append(',');
}
sb.deleteCharAt(sb.length() - 1);
}
sb.append("},");
}
sb.deleteCharAt(sb.length() - 1);
sb.append('}');
return sb.toString();
}
Aggregations