if (prop.getDefinition().isMultiple()) {
Value[] values = prop.getValues();
Value[] newVals = new Value[values.length];
for (int i = 0; i < values.length; i++) {
Value val = values[i];
UUID original = UUID.fromString(val.getString());
UUID adjusted = refTracker.getMappedUUID(original);
if (adjusted != null) {
newVals[i] = session.getValueFactory().createValue(
session.getNodeByUUID(adjusted),
prop.getType() != PropertyType.REFERENCE);
} else {
// reference doesn't need adjusting, just copy old value
newVals[i] = val;
}
}
prop.setValue(newVals);
} else {
Value val = prop.getValue();
UUID original = UUID.fromString(val.getString());
UUID adjusted = refTracker.getMappedUUID(original);
if (adjusted != null) {
prop.setValue(session.getNodeByUUID(adjusted));
}
}
}