Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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:
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.
Reading of Model associations is possible via the method com.axeda.services.v2.Model.getSourceModels()
possible via the method com.axeda.drm.sdk.m2m.ModelAssociation.store()
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?
Reading of DataItem associations is possible via the method Bridges.dataItemBridge.getSourceDataItems(...)
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
Hi Marco,
I took a look at our V2 API. While Model Associations should be possible the way you show, it appears you've stumbled upon a bug there. Model Associations do work correctly when creating the Model using the ModelBridge. However, the associations will not be created during update. The update succeeds, but no source/target associations are created. I have filed a bug and made Product Management aware of the problem so that we can get it on our todo list.
As far as DataItem associations, it appears that no V2 mechanism exists to create DataItem Associations.
As always, feel free to file a Support Ticket for either of these issues. Or, feel free to reply here if there's any additional help we can give.
Thanks,
~James
Hi jbushey,
Thank you for your analysis and filing the bug.
So I will use the v1 API to associate the models.
Do you know how to use the V1 DataItemAssociation API in a current Axeda 6.8 instance?
It appears that I can't use this API because of the com.axeda.drm.services.device.DataItem class.
Thank you in advance.
Kind regards,
Marco
Hello jbushey,
Do you know how to use the V1 DataItemAssociation API in a current Axeda 6.8 instance?
Thank you in advance.
Kind regards,
Marco
Marco:
Please open a support case via the Support Portal. It's possible your instance needs to be moved to a different Code Access Policy level.
Regards,
-Chris Kaminski
PTC Customer Support