Skip to content

Commit

Permalink
New API to support saving local only resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin committed Aug 23, 2023
1 parent 4c2da74 commit 7a45e18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/src/main/java/com/google/android/fhir/FhirEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface FhirEngine {
*/
suspend fun create(vararg resource: Resource): List<String>

suspend fun createRemote(vararg resource: Resource)

/** Loads a FHIR resource given the class and the logical ID. */
suspend fun get(type: ResourceType, id: String): Resource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ internal class FhirEngineImpl(private val database: Database, private val contex
return database.insert(*resource)
}

override suspend fun createRemote(vararg resource: Resource) {
return database.insertRemote(*resource)
}

override suspend fun get(type: ResourceType, id: String): Resource {
return database.select(type, id)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ open class TestDownloadManagerImpl(

object TestFhirEngineImpl : FhirEngine {
override suspend fun create(vararg resource: Resource) = emptyList<String>()
override suspend fun createRemote(vararg resource: Resource) {
TODO("Not yet implemented")
}

override suspend fun update(vararg resource: Resource) {}

Expand Down

0 comments on commit 7a45e18

Please sign in to comment.