ConfigurationRegistry

@Singleton
class ConfigurationRegistry @Inject constructor(val fhirEngine: FhirEngine, val fhirResourceDataSource: FhirResourceDataSource, val sharedPreferencesHelper: SharedPreferencesHelper, val dispatcherProvider: DispatcherProvider, val configService: ConfigService, val json: Json, val context: Context)

Constructors

Link copied to clipboard
@Inject
constructor(fhirEngine: FhirEngine, fhirResourceDataSource: FhirResourceDataSource, sharedPreferencesHelper: SharedPreferencesHelper, dispatcherProvider: DispatcherProvider, configService: ConfigService, json: Json, context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val fhirEngine: FhirEngine
Link copied to clipboard
val json: Json
Link copied to clipboard
@Inject
lateinit var knowledgeManager: KnowledgeManager

Functions

Link copied to clipboard
suspend fun <R : Resource> addOrUpdate(resource: R)

Update this stored resources with the passed resource, or create it if not found. If the resource is a Metadata Resource save it in the Knowledge Manager

Link copied to clipboard
suspend fun createOrUpdateRemote(vararg resources: Resource)

Using this FhirEngine and DispatcherProvider, for all passed resources, make sure they all have IDs or generate if they don't, then pass them to create.

Link copied to clipboard

Fetch non-patient Resources for the application that are not application configurations resources such as ResourceType.Questionnaire and ResourceType.StructureMap. ( ResourceType.Binary and ResourceType.Parameters are currently the only FHIR HL7 resources used to represent application configurations). These non-patients resource identifiers are also set in the section components of the Composition resource.

Link copied to clipboard
suspend fun fetchRemoteCompositionByAppId(appId: String?): Composition?
Link copied to clipboard
suspend fun fetchRemoteCompositionById(id: String?, version: String?): Composition?
Link copied to clipboard
suspend fun fetchRemoteImplementationGuideByAppId(appId: String?, appVersionCode: Int?): ImplementationGuide?
Link copied to clipboard
suspend fun fetchResources(gatewayModeHeaderValue: String? = null, url: String)
Link copied to clipboard
fun getConfigValueWithParam(paramsMap: Map<String, String>?, configKey: String): String

This function interpolates the value for the given configKey by replacing the string placeholders e.g. {{ placeholder }} with value retrieved from the paramsMap using configKey as the key. If value is null the placeholder is returned

Link copied to clipboard
@VisibleForTesting
fun isNonProxy(): Boolean
Link copied to clipboard
suspend fun loadConfigurations(appId: String, context: Context, configsLoadedCallback: (Boolean) -> Unit = {})

Populate application's configurations from the composition resource. Only Binary and Parameter Resources are used to represent application configurations. The configCacheMap is reset on every configs load.

Link copied to clipboard
suspend fun loadResourceSearchParams(): Pair<Map<String, Map<String, String>>, ResourceSearchParams>
Link copied to clipboard
suspend fun populateConfigurationsMap(context: Context, composition: Composition, loadFromAssets: Boolean, appId: String, configsLoadedCallback: (Boolean) -> Unit)
Link copied to clipboard
inline fun <T : Configuration> retrieveConfiguration(configType: ConfigType, configId: String? = null, paramsMap: Map<String, String>? = emptyMap()): T

Retrieve configuration for the provided ConfigType. The JSON retrieved from configsJsonMap can be directly converted to a FHIR resource or hard coded custom model. The filtering assumes you are passing data across screens, then later using it in DataQueries and to retrieve registerConfiguration. It is necessary to check that paramsMap is empty to confirm that the params used in the DataQuery are passed when retrieving the configurations.

Link copied to clipboard
inline fun <T : Configuration> retrieveConfigurations(configType: ConfigType): List<T>
Link copied to clipboard

Retrieve translation configuration for the provided bundleName. The Bundle value is retrieved from configsJsonMap can be directly converted to a ResourceBundle.

Link copied to clipboard
inline fun <T : Base> retrieveResourceConfiguration(configType: ConfigType): T

Retrieve configuration for the provided ConfigType. The JSON retrieved from configsJsonMap can be directly converted to a FHIR resource or hard coded custom model.

Link copied to clipboard
@VisibleForTesting
fun setNonProxy(nonProxy: Boolean)
Link copied to clipboard
fun writeToFile(resource: Resource): File