Cumulocity API Services / com.softwareag.jc.cumulocity.services.models / ManagedObject

ManagedObject

data class ManagedObject : PropertiesBase, JsonSerializable

This is the single most important asset type referenced by Cumulocity. Principally identifies the devices to be managed, but can be used to define any required asset type, such as groups, buildings, rooms etc. etc.

It's formal definition is given in the Cumulocity REST API Guide

Customisation

ManagedObject's can be easily enriched with custom attributes, however this is problematic for a typed language such as Kotlin or Java. In this implementation custom attributes are added to a properties attribute of ManagedObject and identified by the name of the value. Complex structures are flattened into a single key/value pair e.g.

{
 "my_custom_structure": {
     "name": "this is an example"
     "sub_elements": {
             "value": "Can have as many sub-levels as you want"
         }
     }
 }

becomes

properties["my_custom_structure.name"] == "this is an example"
properties["my_custom_structure.name"] == "this is an example"
properties["my_custom_structure.sub_elements.value"] == "Can have as many sub-levels as you want"

You can also add single custom attributes to ManagedObject and reference them too, however they have to be prefaced with 'x' in order to be included e.g.

{
 "xMy_Custom_value": "123456"
}

becomes

properties["xMy_Custom_value"] == "this is an example"

The above is required because there is no formal description available for a ManageObject and hence no way to formally distinguish between standard and custom attributes, hence the 'x'

This could put forward the argument that all custom values should be placed in complex structure as above. Unfortunately this is not always possible, due to the fact that only simple top level custom attributes can be included in Cumulocity dashboards.

You can also register your own classes to replace the flattened structure with a proper object representation if you wish. Refer to the documentation for PropertiesBase for details.

Constructors

<init>

ManagedObject(id: String?, serialNumber: String?, name: String?, supplier: String?, model: String?, revision: String?, type: String, subType: String?, location: Position?, notes: String?)
ManagedObject(name: String?, notes: String?)

Creates new ManageObject to be posted to Cumlocity via ManageObjectService

ManagedObject(o: JSONObject?)

This is the single most important asset type referenced by Cumulocity. Principally identifies the devices to be managed, but can be used to define any required asset type, such as groups, buildings, rooms etc. etc.

Properties

appId

val appId: String?

appOwner

val appOwner: String?

c8y_ActiveAlarmsStatus

val c8y_ActiveAlarmsStatus: Alarms

c8y_Availability

var c8y_Availability: Availability?

c8y_ConnnectionStatus

var c8y_ConnnectionStatus: String?

c8y_DataPoint

var c8y_DataPoint: DataPoints

c8y_Firmware

var c8y_Firmware: Firmware?

c8y_Hardware

var c8y_Hardware: Hardware

c8y_Notes

var c8y_Notes: String?

c8y_Position

var c8y_Position: Position?

c8y_RequiredAvailability

var c8y_RequiredAvailability: RequiredAvailability?

c8y_SupportedOperations

var c8y_SupportedOperations: List<String>

createdDate

val createdDate: Date?

id

val id: String?

isLPWANProvisioned

val isLPWANProvisioned: Boolean

lNSType

var lNSType: String?

name

val name: String?

owner

val owner: String?

subType

val subType: String?

type

val type: String?

updatedDate

val updatedDate: Date?

Inherited Properties

properties

val properties: HashMap<String, Any>

Collection of any custom attributes found in the ManageObject structure

Functions

toJSONString

fun toJSONString(): String

updateId

fun updateId(id: String): Unit

Updates the internal id with that of the paramter, used internally to set the id of a newly posted ManageObject with the new id returned from Cumulocity