FHIR Chat · Generic Resource Provider · hapi

Stream: hapi

Topic: Generic Resource Provider


view this post on Zulip Matthieu Vegreville (Jun 30 2019 at 19:01):

Hello all,

We are currently implementing the HAPI FHIR server framework against our own storage.
Is it possible in the HAPI framework to create a generic resource provider that takes any type of resource in input and persist it in our storage (we basically post the resource JSON on an API)?
It seems that even with the Plain Provider, you need to specify for which type of Resource the operation applies (or it is inferred from the type of the method parameter).

Thanks!

view this post on Zulip James Agnew (Jun 30 2019 at 22:20):

Unfortunately it's not currently possible to create a single resource provider instance that handles multiple types.

You can get close though by having a single class that you instantiate once per resource type you want to support. It's not completely optimal but it does work well. You can see an example of this in HashMapResourceProvider: https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/HashMapResourceProvider.java

view this post on Zulip Matthieu Vegreville (Jul 01 2019 at 12:01):

Thank you James, will look into this!


Last updated: Apr 12 2022 at 19:14 UTC