How do I configure DataItem associations programmatically?
Hello everybody,
Currently I try to automate the configuration of Device, Model and DataItem associations via the Axeda Platform Groovy API on Axeda 6.6/6.8.
Up to now I have found the following API parts:
Device association:
The creation of Device associations is possible via the class com.axeda.drm.sdk.m2m.DeviceAssociation and its store() method from older parts of the Axeda API.
Model association:
Reading of Model associations is possible via the method com.axeda.services.v2.Model.getSourceModels()
Creation via v1:
possible via the method com.axeda.drm.sdk.m2m.ModelAssociation.store()
Creation via v2:
com.axeda.services.v2.Model sourceModel = Bridges.modelBridge.find(sourceModelName)
com.axeda.services.v2.Model targetModel = Bridges.modelBridge.find(targetModelName)
sourceModel.targetModels.add(targetModel)
Bridges.modelBridge.update(sourceModel)
-> Unfortunately this does not work. Any suggestions?
DataItem association:
Reading of DataItem associations is possible via the method Bridges.dataItemBridge.getSourceDataItems(...)
Creation:
Up to now I've only found the class com.axeda.drm.sdk.m2m.DataItemAssociation with its method store()
Unfortunately the implementation of DataItemAssociation requires to also set the source/target com.axeda.drm.services.device.DataItem (old/internal API?) instances, too:
public void store() {
if(!this.deviceAssociationManager.isDataItemAssociated(this.sourceTagId, this.destinationTagId)) {
this.deviceAssociationManager.createDataItemAssociation(this.sourceDataItem, this.destinationDataItem);
}
}
In contrast the classes ModelAssociation and DeviceAssociation only require the system Ids to associate Models/Devices.
Is there any v2 API to associate DataItems?
Thank you in advance.
Best regards,
Marco

