Why does copyContents ignore a metaData change if its value has been removed from the source document.
https://github.com/nuxeo/nuxeo/blob/master/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/impl/DocumentModelImpl.java#L1210
I see that while calling the copyContents method, if the dataModel encounters a empty or null value, it moves ahead without replacing the destination field with the NULL value.
Was there any specific reason for doing like this? I thought of modifying the underlying logic. But i m not able to build and replace the NUXEO_CORE_API jar in my local bundles folder.
Changed copyContents() method can be found below
public static DataModel cloneDataModel(Schema schema, DataModel data) {
DataModel dm = new DataModelImpl(schema.getName());
for (Field field : schema.getFields()) {
String key = field.getName().getLocalName();
Object value;
try {
value = data.getData(key);
} catch (PropertyException e1) {
continue;
}
Object clone =null;
if (value != null) {
clone = cloneField(field, key, value);
}
try {
dm.setData(key, clone);
} catch (PropertyException e) {
throw new ClientRuntimeException(e);
}
}
return dm;
}