This repository has been archived by the owner on Oct 3, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fulton
committed
Feb 6, 2020
1 parent
a73a359
commit de4c436
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/java/com/andromeda/araserver/localSearchData/ReadDB.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
package com.andromeda.araserver.localSearchData | ||
|
||
import com.microsoft.azure.documentdb.* | ||
import org.json.JSONObject | ||
|
||
class ReadDB { | ||
fun main(client: DocumentClient): ArrayList<SkillsFromDB> { | ||
val skillsFromDB = ArrayList<SkillsFromDB>() | ||
val options = FeedOptions() | ||
options.partitionKey = PartitionKey("readonly") | ||
val queryResults: FeedResponse<Document> = client.queryDocuments("/dbs/Ara-android-database/colls/Ara-android-collection", "SELECT * FROM c ", options) | ||
for (i in queryResults.queryIterator){ | ||
val json = i.get("document") as JSONObject | ||
val model = SkillsFromDB( | ||
pre = json.getString("pre"), | ||
end = "", | ||
action= json.getString("action") | ||
) | ||
skillsFromDB.add(model) | ||
} | ||
return skillsFromDB | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters