From 74ade289d32bfeafde5d8c2f6ea3d4cba9ac5111 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:00:56 +0300 Subject: [PATCH] New API to support saving local only resources - https://github.com/google/android-fhir/issues/2123 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 ++ .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index f0cc2f72f9..376ff3b327 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -34,6 +34,8 @@ interface FhirEngine { */ suspend fun create(vararg resource: Resource): List + 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 diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index 3b9911d66f..de35675a0b 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -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) }