// set the name in the encounter wrapper object
encounter.setName(name);
// create or set object data
ObjectData datum = encounter.getObjectInstance().getData().get("name");
logger.trace("datum: " + datum);
if(datum == null) {
ObjectProperty op = encounter.getObjectInstance().getObjectTemplate().getProperty("name");
logger.trace("op: " + op);
if(op == null) {
logger.error("Object property 'name' couldn't be found in template: "
+ encounter.getObjectInstance().getObjectTemplate());
// alert service
alertService.addAlert(new Alert(Alert.Type.ERROR, EncounterBuilderEditor.class.getSimpleName(),
"Object property 'name' couldn't be found in template: "
+ encounter.getObjectInstance().getObjectTemplate().getName()));
return;
}
datum = objectDataFactory.createObjectData(op, false);
logger.trace("datum: " + datum);
if(datum != null) {
datum.setName("name");
encounter.getObjectInstance().addData(datum);
}
else {
logger.error("Object data couldn't be created for 'name' from object property: " + op);
// alert service
alertService.addAlert(new Alert(Alert.Type.ERROR, EncounterBuilderEditor.class.getSimpleName(),
"Object data couldn't be created for 'name' from object property: " + op.getName()));
return;
}
}
datum.setValue(name);
doSave(null);
setPartName(getTitle());
}