cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How do I configure DataItem associations programmatically?

mbratz
1-Newbie

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

4 REPLIES 4
jamesb
5-Regular Member
(To:mbratz)

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

mbratz
1-Newbie
(To:jamesb)

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

mbratz
1-Newbie
(To:jamesb)

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

ckaminski
13-Aquamarine
(To:mbratz)

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

Top Tags