This page last changed on Nov 24, 2013 by digitaldan.

I'm trying to use DeviceAttrs to persist information about a device with my omnilink protocol. After saving my device this information is never written to the database, and the device_attr table is empty. I don't see anything else using this in the designer code base so maybe its just not supported anymore? My code looks like this:

List<DeviceAttr> dattrs = new ArrayList<DeviceAttr>();
DeviceAttr datt = new DeviceAttr();
datt.setName(STR_ATTRIBUTE_NAME_OMNI_NUM);
datt.setValue(objnum + "");
dattrs.add(datt);

datt = new DeviceAttr();
datt.setName(STR_ATTRIBUTE_NAME_OMNI_TYPE);
datt.setValue(Message.OBJ_TYPE_UNIT + "");
dattrs.add(datt);

device.setDeviceAttrs(dattrs);

Saving the device persists it in the database but does not persist the DeviceAttrs.

Big chance it's not working. I've never used it or reviewed that part of the code since I started with OR.
I'll see if I can take a quick look at that.

Posted by ebariaux at Nov 25, 2013 09:31

Thanks. I was trying to use this to avoid duplicates when importing more then once (say if you add a device) so I don't have to rely on the name to be unique. Instead of using deviceattr i'm now comparing the name, vendor and model. While probably less then ideal, it will work the vast majority of the time.

Posted by digitaldan at Nov 25, 2013 14:44
Document generated by Confluence on Jun 05, 2016 09:30