Skip to content

Instantly share code, notes, and snippets.

@axeda
Created July 26, 2011 14:23
Show Gist options
  • Select an option

  • Save axeda/1106875 to your computer and use it in GitHub Desktop.

Select an option

Save axeda/1106875 to your computer and use it in GitHub Desktop.
Add an asset to an asset group
<!-- Add parameter "assetgroupname" -->
import com.axeda.drm.sdk.device.DeviceGroupFinder
import com.axeda.drm.sdk.device.DeviceGroup
import com.axeda.drm.sdk.Context
try {
def assetgroupname = parameters.assetgroupname
DeviceGroupFinder dgf = new DeviceGroupFinder(Context.create())
dgf.setName(assetgroupname )
DeviceGroup dg = dgf.find()
dg.addDevice(context.device)
dg.store()
logger.info "Added " + context?.device?.serialNumber + " to " + dg.name + " -> " + dg.parentPath
}
catch(Exception e)
{
logger.error(e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment