-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overload FhirEngine.get() to Allow Fetching Multiple Resources by their IDs #2743
base: master
Are you sure you want to change the base?
Changes from 3 commits
7aa06df
7544694
10e46a0
fb3b13b
167e896
0ca0813
abd41d0
4422497
32952bb
8274e48
4a68b78
d59c542
3c2bc65
84b229f
9a5c079
de945a5
ec81cbf
ffa535a
fc9a379
6968bf1
6102e52
e87bf59
efee30b
92b1938
1327fec
7a45e18
0cae350
bb1f2eb
a6b0ec2
bf060ad
75f243d
57b4773
d7036a9
49ca6fa
714290d
edb2842
95633d2
8de5078
e31fc6f
efd3444
f43abf5
6a1ccc3
283ad6e
b9ded79
1721a4a
52ff928
3a33df4
110c322
658f9c4
78d5bb5
d8401b9
563c233
7d7d440
0fc5d21
6d7f341
fcb6691
e325ba4
c9ca366
ac92d70
136833a
c7d2465
824e171
b695b46
ea0ebef
944868f
111c662
afbfd9a
9615372
a25182b
5276c82
de504eb
000fa42
7386fd4
d03017a
8c43299
6ebc36d
2a437d0
dfe6232
6893a6a
219cd36
d881d97
64ffbae
79b9ca7
e049913
4279623
675602b
320ee39
465c684
4f0fea0
65a342d
7534916
3e4ccf8
e6439e3
7097dfb
c5cb3c7
4dbbca5
1942489
afb0f8c
207190c
d373dd1
91795e8
c3d476f
a3932bc
05e9ed6
32a567e
f7a23c9
c74d722
ae42ddb
6dee127
5643dd0
eb73046
e4ce820
38dc9d2
6c07210
e9ce8c2
51dc8ec
ee02125
35794b5
1531f9b
23d4f53
748664e
7a756c6
865fdae
45d48aa
7a75afb
54f2d14
c78f967
3f726f5
3ef1357
6a669eb
edf4ce8
5ac8323
0ae5301
e05493e
6361100
e3a55b6
d89a932
fccf015
cea5a07
18d0100
20912f5
4eb2ca2
ff31ccd
34121d6
db8ffbc
64deedb
4af8cc9
bbb7051
db494e6
df94004
3e8fdb5
7e6fb31
9d2f6d1
494a7c6
6a5286a
3fc4608
60d20e1
66b0963
4992100
ae0e4ce
7522e98
cd6268e
e0cebb2
4f3bad5
9a923af
a0dab66
2036be9
8d64417
52c257e
c1e6a95
5787c7f
d871fa3
5720eb2
60e7d6d
6bd2d48
e1cf4c5
5bc45d1
9b4c893
545aa69
ffb393f
45b96ff
fad0ede
10e24ef
0d17139
440d74c
c6715e6
8eb6781
eb24a9a
c021771
3181613
7300429
7384cea
d43a0e8
855b580
2a95708
bd47870
3e733d7
f7b4791
14dc23d
e60758b
eb2890c
410fa5c
8b53cd2
2355d0d
0abb05d
715502b
f86079c
a3f242b
ea1768c
3837219
b2f59d1
cb3bdf9
68445e0
dc6e601
fbb0b0a
9dd1aaf
ffed82a
1b27ad7
c1abadb
391fe0a
98e4c49
cd4606b
3b6195a
d48d338
6033cd2
89417fd
68afe18
04974a0
200428a
29dd821
c9ad228
0b89a59
7e75f92
83cb936
a2adcd4
e9721d7
d1b6875
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,17 @@ interface FhirEngine { | |
@Throws(ResourceNotFoundException::class) | ||
suspend fun get(type: ResourceType, id: String): Resource | ||
|
||
/** | ||
* Loads multiple FHIR resources given [ResourceType] and logical IDs. | ||
* | ||
* @param type The type of the resource to load. | ||
* @param ids The logical IDs of the resources. | ||
* @return The list of requested FHIR resources. | ||
* @throws ResourceNotFoundException if the resources are not found. | ||
*/ | ||
@Throws(ResourceNotFoundException::class) | ||
suspend fun get(type: ResourceType, vararg ids: String): List<Resource> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update the exception to say that if any resources are not found, this will throw. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean if a request is made for 3 resources and only 2 are available it should throw an exception? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a scenario where getting all resources in the list is mandatory and returning a subset may break functionality? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't actually know how this really works with the original api.. it seems to me it'd be ambiguous to the compiler if the first or the second api is called when you're getting only 1 resource... can you verify this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The alternative would be to add a separate What do you think of this approach? |
||
|
||
/** | ||
* Updates one or more FHIR [Resource]s in the local storage. | ||
* | ||
|
@@ -227,6 +238,19 @@ suspend inline fun <reified R : Resource> FhirEngine.get(id: String): R { | |
return get(getResourceType(R::class.java), id) as R | ||
} | ||
|
||
/** | ||
* Retrieves FHIR resources of type [R] with the given [ids] from the local storage. | ||
* | ||
* @param R The type of the FHIR resource to retrieve. | ||
* @param ids The logical IDs of the resources to retrieve. | ||
* @return The list of requested FHIR resources. | ||
* @throws ResourceNotFoundException if the resource is not found. | ||
*/ | ||
@Throws(ResourceNotFoundException::class) | ||
suspend inline fun <reified R : Resource> FhirEngine.get(vararg ids: String): List<R> { | ||
return get(getResourceType(R::class.java), *ids).map { it as R } | ||
} | ||
|
||
/** | ||
* Deletes a FHIR resource of type [R] with the given [id] from the local storage. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add some tests