HS.BulkFHIR.API.Data.AdapterConfig
class HS.BulkFHIR.API.Data.AdapterConfig extends %Library.RegisteredObject, %JSON.Adaptor
Base adapter configuration class. Any auth/fetch/storage adapter's accompanying configuration file must subclass this class and define properties (and optionally validation). config properties should be in snake case, since the GUI config defaults to prettifying snake cases (.e.g. fetch_adapter becomes Fetch Adapter)Method Inventory
Parameters
parameter DOMAIN = HSBFCMsg;
parameter ValidPresetOptions = credentials,oauth_clients,client_auth_oauth_clients,auth_adapters,fetch_adapters,client_auth_adapters,storage_adapters,tls_configurations,local_fhir_endpoints,fhir_resources;
Methods
classmethod ExtractRelevantLiteralPropertiesForGUISetting(pLiteralPropertiesList As %List) as %DynamicObject
Given @Input pLiteralPropertiesList (which corresponds to the "Parameters" property of a %Dictionary.CompiledProperty)
Return a dynObj of the following schema which contains the relevant properties we need to construct the GUI setting for the UI:
{
maxLength: number,
valueList: %List,
displayList: %List
}
classmethod FromJson(json) as HS.BulkFHIR.API.Data.AdapterConfig
@API
Converts a json string or %DynamicObject into an instance of
the config object
classmethod GUISettings() as %DynamicArray
Optional custom settings for the GUI, i.e. how the end user will interact with the config class and its properties
Each property setting may be customized according to the following schema:
{
name: string (must match precisely name of property in the class)
ignore: boolean (if true, no other property need be set - this property will be ignored by GUI and inaccessible to user)
display_name: string (name of the field shown to user)
Defaults to prettified version of snake case property name
description: string (description of the field shown to the user in a hint)
Defaults to the property's in-line comment in code
is_advanced: boolean (whether the field should be nested in a collapsible "advanced setting" group)
If true and the property is required, the property SHOULD have a default, or else results in a poor UX
input_type: string (the type of field shown to user) with following value list:
"input", "select", "radio", "binary-checkbox", "number".
If "select" or "radio", then options must be provided either via literal property VALUELIST or the "presetOptions" GUI setting (see below).
If binary-checkbox, the property must be typed %Boolean.
Defaults according to the property type as follow:
If %Integer or %Double, then "number"
If %Boolean, then "binary-checkbox"
If VALUELIST is provided, then "select"
If the type is a different config class, then special "nested-setting", and the GUI setting for this property will be defined in the "nested_setting" property (see below).
Else, "input"
preset_options: string (preset list of options available) with following value list (enforced by parameter ValidPresetOptions)
"credentials", list of credentials configured in the BFC namespace
"client_auth_oauth_clients", list of non-resource OAuth clients as available in the instance. If this preset option is chosen, the UI will show a selectable table of OAuth clients.
"oauth_clients", list of all OAuth clients as available in the instance. If this preset option is chosen, the UI will show a selectable table of OAuth clients.
"auth_adapters", list of auth adapters available in the BFC namespace
"fetch_adapters", list of fetch adapters available in the BFC namespace
"client_auth_adapters", list of client auth adapters available in the BFC namespace
"storage_adapters", list of storage adapters available in the BFC namespace
"tls_configurations", list of TLS configurations
"local_fhir_endpoints", list of FHIR Server endpoints local to the instance
"fhir_resources", list of applicable FHIR resource types - only applicable if sister property "endpoint_url" exists (as is in HS.BulkFHIR.API.Data.FetchAdapterConfig or subclass, since it relies on discovering what resources the FHIR server supports)
default: any (defaults to InitialExpression or %onNew override)
required: boolean (whether the property is required, defaults to whether the property is marked as required or not in the class definition)
/// The following properties are calculated based on the property and not customizable
collection: boolean (calculated from whether the element is a list)
nested_setting: array of nested instances of this schema (applies when the property type is a nested config class and thus inputType is "nested-setting")
type: string (property data type)
options: { name: string, value: string } (derived from VALUELIST/DISPLAYLIST literal properties, not evaluated if preset_options is defined)
max_length: number (derived from MAXLEN literal property)
}
final classmethod GenerateGUISettings() as %DynamicArray
Generate the GUI settings as an dynArray of dynObjects whose schema is noted in the method GUISettings(),
The order of the settings is meaningful - they will show up in the UI form precisely according to this order.
The method starts by taking the custom settings (overrides) from GUISettings() and then applying defaults where appropriate.
the goal is to generate the GUI settings by merging the custom settings returned by the GUISettings() method and the default settings.
The custom settings may be subset of the default settings, which is generated for every property of the config class
e.g. custom settings may be just [ {name: "internal_prop", ignore: 1} ] (we wish to take all defaults, except ignore this one)
The default ordering will be according to whatever is returned in query to %Dictionary.CompiledProperty, which seems almost random
But as the custom settings as returned by GUISettings() will be meaningfully ordered, the final settings array will comprise
of the properties as ordered by the custom settings array, followed by the rest of the defaults in the default order.
example:
default settings: [ {a}, {b}, {c}, {d}, {e} ]
custom settings: [ {b}, {e} ]
final settings: [ {b}, {e}, {a}, {c}, {d} ], where b and e are merges of custom over default.
If the desire is to take all defaults but in a specific order, all one has to do is code GUISettings() to return a simple ordered dynamic array
of property name such as [{name:"propA"},{name:"propB"},{name:"propC"}]
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %JSONExport()
- %JSONExportToStream()
- %JSONExportToString()
- %JSONImport()
- %JSONNew()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()