Cisco Cisco Prime Home 6.3 Guida Dello Sviluppatore
Cisco Prime Home – Integration Guide
OL-28558-01 v5.1
55
*/
def setRMA(sn: String, oui: String): DeviceData = {
val rmaFor = new JSONObject
rmaFor
rmaFor
.put("sn", sn)
.put("oui", oui)
.put("oui", oui)
json.put("rmaFor", rmaFor)
this
this
}
/**
/**
*
*/
*/
def setApplicationDTO(applicationCode: String, name: String, value:
String): DeviceData = {
String): DeviceData = {
json
.getJSONObject("applications")
.getJSONObject(applicationCode)
.getJSONObject("dto")
.deepPut(name, value)
.getJSONObject(applicationCode)
.getJSONObject("dto")
.deepPut(name, value)
this
}
}
DeviceService.scala
package com.clearaccess.example.api
import org.springframework.beans.factory.annotation.Autowired
import com.clearaccess.spring.rest.RestTemplate
import com.clearaccess.example.HttpConfiguration
import org.springframework.stereotype.Component
import org.json.JSONObject
@Component
class DeviceService @Autowired()(
val restTemplate: RestTemplate,
val httpConfiguration: HttpConfiguration
) extends JSONHelpers {
private def devicesUrl: String =
val httpConfiguration: HttpConfiguration
) extends JSONHelpers {
private def devicesUrl: String =
"http://%s/prime-home/api/v1/devices".format(httpConfiguration.host)
private def deviceTemplateUrl: String =
"http://%s/prime-
home/api/v1/templates/device".format(httpConfiguration.host)
private def deviceDataUrl(deviceId: Long): String =
"http://%s/prime-
home/api/v1/devices/%d/data".format(httpConfiguration.host, deviceId)
private def deviceUrl(deviceId: Long): String =
"http://%s/prime-home/api/v1/devices/%d".format(httpConfiguration.
host, deviceId)
private def deviceActionsUrl(deviceId: Long): String =
"http://%s/prime-home/api/v1/devices/%d/actions".format(httpConfig
uration.host, deviceId)