Skip to main content
10-Marble
March 18, 2015
Question

V2 equivalent of context.getDevice

  • March 18, 2015
  • 2 replies
  • 897 views

Hi,

 

Is there a V2 equivalent of context.getDevice that will return an Asset instead of a V1 Device object? If not, what would be the recommended method for obtaining the Asset object when a Custom Object is triggered by an Expression Rule?

 

Thanks!

Alan

    2 replies

    5-Regular Member
    March 18, 2015

    Unfortunately there is no way to get a v2 equivalent without fetching it back again as of the latest version of the Axeda Platform 6.8.

    I would simply do:


    import static com.axeda.sdk.v2.dsl.Bridges.*



    Asset v2Asset = assetBridge.findById(context.getDevice().getId().toString())


    //use the v2Asset


    I recognize that's less than ideal but it'd work fine.

    Cheers,

    -Clint

    ablyth10-MarbleAuthor
    10-Marble
    March 18, 2015

    Lovely one-liner,

    Thanks Clint, i was hoping you'd be around and provide an excellent answer as always!

    Alan,