05-13-2016 05:30 PM
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;
}
05-18-2016 05:41 AM
Hi. Could you provide a unit test that demonstrates why in your opinion the current behavior is wrong? We use copyContent
to copy data from an existing DocumentModel
into a newly-created empty one, so the current behavior is correct in my opinion.
05-18-2016 12:46 PM
I don't have a unit test handy. You are correct. As per the Current behavior, the data gets copied over without any issues into a new empty document.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.