+ prop.getName()));
}
} else if (values.length == 0) {
// do not create new prop here, but clear existing
if (parent.hasProperty(prop.getName())) {
Value val = session.getValueFactory().createValue("");
parent.setProperty(prop.getName(), val);
changes.add(Modification.onModified(parentPath + "/"
+ prop.getName()));
}
} else if (values.length == 1) {
boolean removedProp = removePropertyIfExists(parent, prop.getName());
// if the provided value is the empty string, we don't have to do
// anything.
if (values[0].length() == 0) {
if (removedProp) {
changes.add(Modification.onDeleted(parentPath + "/"
+ prop.getName()));
}
} else {
// modify property
if (type == PropertyType.DATE) {
// try conversion
Calendar c = dateParser.parse(values[0]);
if (c != null) {
if (prop.hasMultiValueTypeHint()) {
final Value[] array = new Value[1];
array[0] = session.getValueFactory().createValue(c);
parent.setProperty(prop.getName(), array);
changes.add(Modification.onModified(parentPath
+ "/" + prop.getName()));
} else {
Value cVal = session.getValueFactory().createValue(
c);
parent.setProperty(prop.getName(), cVal);
changes.add(Modification.onModified(parentPath
+ "/" + prop.getName()));
}
return;
}
// fall back to default behaviour
}
if (type == PropertyType.UNDEFINED) {
Value val = session.getValueFactory().createValue(
values[0], PropertyType.STRING);
parent.setProperty(prop.getName(), val);
} else {
if (prop.hasMultiValueTypeHint()) {
final Value[] array = new Value[1];
array[0] = session.getValueFactory().createValue(
values[0], type);
parent.setProperty(prop.getName(), array);
} else {
Value val = session.getValueFactory().createValue(
values[0], type);
parent.setProperty(prop.getName(), val);
}
}
changes.add(Modification.onModified(parentPath + "/"