Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
shifting some stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Dec 24, 2019
1 parent 5aa3927 commit d019c1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/andromeda/araserver/iot/GetDevices.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class GetDevices {
val devices = ArrayList<DeviceModel>()
val options = FeedOptions()
options.partitionKey = PartitionKey("user-$key")
val queryResults: FeedResponse<Document> = client.queryDocuments(
"/dbs/Ara-android-database/colls/Ara-android-collection",
"SELECT * FROM c WHERE c.id = '$id'",
options
)

val queryResults: FeedResponse<Document> = client.queryDocuments("/dbs/Ara-android-database/colls/Ara-android-collection", "SELECT * FROM c WHERE c.id = '$id'", options)
for (i in queryResults.queryIterator){
val json = i.get("document") as JSONObject
val deviceModel = DeviceModel(json.getString("name"), json.getString("type"), json.getString("status"), "")
val deviceModel = DeviceModel(
name = json.getString("name"),
type = json.getString("type"),
status = json.getString("status"),
group = ""
)
devices.add(deviceModel)
}
return devices
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/andromeda/araserver/iot/Main.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.andromeda.araserver.iot

import com.microsoft.azure.documentdb.*
import kotlin.reflect.KType
import kotlin.reflect.full.instanceParameter
import kotlin.reflect.full.memberProperties
import kotlin.reflect.jvm.javaType


class Main {
Expand All @@ -24,10 +27,8 @@ class Main {
val deviceClass = TypeClassMap().main(device!!.type)
val currentState = GetDeviceValues().yamlArrayToObjectList(device.status, deviceClass)
val pair = currentState!![0] to deviceClass
println(currentState[0] )
val classToMod = pair.second ?: throw NullPointerException()
classToMod.kotlin.memberProperties.forEach { member ->
println("${member.name} ")
}
return ""
}
}

0 comments on commit d019c1c

Please sign in to comment.