jcrNode.changePropertyType(String.valueOf(me.getKey()), propertyType);
break;
}
case VALUE: {
try{
final JcrProperty property = getNode().getProperty(getPropertyName());
final int propertyType = property.getType();
String encodedValue;
if (property.isMultiple()) {
Object[] values = (Object[])value;
encodedValue = "";
for (int i = 0; i < values.length; i++) {
Object aValue = values[i];
String aValueAsString = PropertyTypeSupport.encodeValueAsString(aValue, propertyType);
if (i==0) {
encodedValue = aValueAsString;
} else {
encodedValue = encodedValue+","+aValueAsString;
}
}
encodedValue = "["+encodedValue+"]";
} else {
encodedValue = PropertyTypeSupport.encodeValueAsString(value, propertyType);
}
if (propertyType!=PropertyType.STRING && propertyType!=PropertyType.NAME) {
encodedValue = "{"+PropertyType.nameFromValue(propertyType)+"}"+encodedValue;
}
jcrNode.setPropertyValue(me.getKey(), encodedValue);
} catch(Exception e) {
// emergency fallback
jcrNode.setPropertyValue(me.getKey(), String.valueOf(value));
}
break;
}
case MULTIPLE: {
if (!(value instanceof Integer)) {
// value must be an integer
return;
}
final Integer newIsMultipleValue = (Integer) value;
final boolean newIsMultiple = newIsMultipleValue==1;
final JcrProperty property = getNode().getProperty(getPropertyName());
final boolean oldIsMultiple = property.isMultiple();
if (newIsMultiple==oldIsMultiple) {
// then nothing is to be done
return;
}
final String oldPropertyValue = getNode().getProperties().getValue(getPropertyName());