Ongoing work on docs migration
|
@ -0,0 +1,46 @@
|
||||||
|
# Android Client
|
||||||
|
|
||||||
|
HAPI now has a specially built module for use on Android. Android developers may use this JAR to take advantage of the FHIR model classes, and the FHIR client (running a FHIR server on Android is not yet supported. Get in touch if this is something you are interested in working on!)
|
||||||
|
|
||||||
|
As of HAPI FHIR 3.1.0, the <code>hapi-fhir-android</code> module has been streamlined in order to reduce its footprint. Previous versions of the library included both an XML and a JSON parser but this has been streamlined to only include JSON support in order to reduce the number of libraries required in an Android build.
|
||||||
|
|
||||||
|
When using the HAPI FHIR Android client, the client will request only JSON responses (via the HTTP <code>Accept</code> header) and will not be able to communicate with FHIR servers that support only XML encoding (few, if any, servers actually exist with this limitation that we are aware of).
|
||||||
|
|
||||||
|
The Android client also uses the <code>hapi-fhir-client-okhttp</code> module, which is an HTTP client based on the OkHttp library. This library has proven to be more powerful and less likely to cause issues on Android than the Apache HttpClient implementation which is bundled by default.
|
||||||
|
|
||||||
|
Note that the Android JAR is still new and hasn't received as much testing as other parts of the library. We would greatly appreciate feedback, testing, etc. Also note that because mobile apps run on less powerful hardware compared to desktop and server applications, it is all the more important to keep a single instance of the `FhirContext` around for good performance, since this object is expensive to create. We are hoping to improve performance of the creation of this object in a future release. If you are an Android developer and would like to help with this, please get in touch!
|
||||||
|
|
||||||
|
## Get the Android JAR
|
||||||
|
|
||||||
|
To add the HAPI library via Gradle, you should add the [hapi-fhir-android](https://search.maven.org/search?q=g:ca.uhn.hapi.fhir%20AND%20a:hapi-fhir-android&core=gav) library to your Gradle file, as well as a structures library for the appropriate version of FHIR that you want to support, e.g. [hapi-fhir-structures-r4](https://search.maven.org/search?q=g:ca.uhn.hapi.fhir%20AND%20a:hapi-fhir-structures-r4&core=gav).
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
dependencies {
|
||||||
|
compile "ca.uhn.hapi.fhir:hapi-fhir-android:3.1.0-SNAPSHOT"
|
||||||
|
compile "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:3.1.0-SNAPSHOT"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You will also need to manually exclude the Woodstox StAX library from inclusion, as this library uses namespaces which are prohibited on Android. You should also exclude:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
configurations {
|
||||||
|
all*.exclude group: 'org.codehaus.woodstox'
|
||||||
|
all*.exclude group: 'org.apache.httpcomponents'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
To see a sample Gradle file for a working Android project using HAPI FHIR, see the [Android Integration Test](https://github.com/hapifhir/hapi-fhir-android-integration-test) project.
|
||||||
|
|
||||||
|
# Performance
|
||||||
|
|
||||||
|
On mobile devices, performance problems are particularly noticeable. This is made worse by the fact that some economy Android devices have much slower performance than modern desktop computers. See the [Client Configuration Performance](/docs/client/rest_client_http_config.html#performance) page for some tips on how to improve client performance.
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
The following is intended to be a selection of publicly available open source Android applications which use HAPI FHIR and might be useful as a reference.
|
||||||
|
|
||||||
|
If you know of others, please let us know!
|
||||||
|
|
||||||
|
* [https://github.com/hapifhir/hapi-fhir-android-integration-test](https://github.com/hapifhir/hapi-fhir-android-integration-test) - hapi-fhir-android Integration Test and Reference Application is our test platform for validating new releases. Created by Thomas Andersen.
|
||||||
|
* [https://github.com/SynappzMA/FHIR-Android](https://github.com/SynappzMA/FHIR-Android) - Nice FHIR DSTU2 search app
|
|
@ -3,5 +3,19 @@ section.introduction.title=Welcome to HAPI FHIR
|
||||||
page.introduction.table_of_contents=Table of Contents
|
page.introduction.table_of_contents=Table of Contents
|
||||||
page.introduction.introduction=Introduction
|
page.introduction.introduction=Introduction
|
||||||
|
|
||||||
|
section.model.title=Working With The FHIR Model
|
||||||
|
page.model.profiles_and_extensions=Profiles and Extensions
|
||||||
|
page.model.converter=Version Converters
|
||||||
|
page.model.custom_structures=Custom Structures
|
||||||
|
|
||||||
|
section.server.title=Server
|
||||||
|
page.server.cors=CORS
|
||||||
|
|
||||||
|
section.android.title=Android Support
|
||||||
|
page.android.client=Android Client
|
||||||
|
|
||||||
|
section.tools.title=Tools
|
||||||
|
page.tools.hapi_fhir_cli=Command Line Interface (CLI) Tool
|
||||||
|
|
||||||
section.appendix.title=Appendix
|
section.appendix.title=Appendix
|
||||||
page.appendix.changelog=Changelog
|
page.appendix.changelog=Changelog
|
||||||
|
|
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
# HL7 FHIR Converter
|
||||||
|
|
||||||
|
Beginning in HAPI FHIR 2.3, a new module called `hapi-fhir-converter` has been added to the project. This is an <b>experimental feature</b> so use it with caution!
|
||||||
|
|
||||||
|
This feature allows automated conversion from earlier versions of the FHIR structures to a later version.
|
||||||
|
|
||||||
|
The following page shows some basic examples. Please get in touch if you are able to contribute better examples!
|
||||||
|
|
||||||
|
## Importing the Module
|
||||||
|
|
||||||
|
To use the `hapi-fhir-converter` module, import the following dependency into your project pom.xml (or equivalent)
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
<artifactId>hapi-fhir-converter</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Converting from DSTU2 to DSTU3
|
||||||
|
|
||||||
|
The following example shows a conversion from a `hapi-fhir-structures-hl7org-dstu2` structure to a `hapi-fhir-structures-dstu3` structure.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ConverterExamples.java|1020}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Converting from DSTU2.1 to DSTU3
|
||||||
|
|
||||||
|
The following example shows a conversion from a `hapi-fhir-structures-dstu2.1` structure to a `hapi-fhir-structures-dstu3` structure.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ConverterExamples.java|1420}}
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
# Custom Structures
|
||||||
|
|
||||||
|
Typically, when working with FHIR the right way to provide your own extensions is to work with existing resource types and simply add your own extensions and/or constrain out fields you don't need.
|
||||||
|
|
||||||
|
This process is described on the [Profiles & Extensions](./profiles_and_extensions.html) page.
|
||||||
|
|
||||||
|
There are situations however when you might want to create an entirely custom resource type. This feature should be used only if there is no other option, since it means you are creating a resource type that will not be interoperable with other FHIR implementations.
|
||||||
|
|
||||||
|
<p class="doc_info_bubble">
|
||||||
|
This is an advanced features and isn't needed for most uses of HAPI-FHIR. Feel free to skip this page.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# Custom Resource Structure
|
||||||
|
|
||||||
|
The following example shows a custom resource structure class:
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/customtype/CustomResource.java|resource}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom Datatype Structure
|
||||||
|
|
||||||
|
The following example shows a custom datatype structure class:
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/customtype/CustomDatatype.java|datatype}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using the Custom Structure
|
||||||
|
|
||||||
|
And now let's try the custom structure out:
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/customtype/CustomUsage.java|usage}}
|
||||||
|
```
|
||||||
|
|
||||||
|
This produces the following output (some spacing has been added for readability):
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<CustomResource xmlns="http://hl7.org/fhir">
|
||||||
|
<meta>
|
||||||
|
<profile value="http://hl7.org/fhir/profiles/custom-resource"/>
|
||||||
|
</meta>
|
||||||
|
|
||||||
|
<televisionDate value="2015-01-01"/>
|
||||||
|
<televisionCustomDatatype>
|
||||||
|
<date value="2016-05-22T08:30:36-04:00"/>
|
||||||
|
<kittens value="FOO"/>
|
||||||
|
</televisionCustomDatatype>
|
||||||
|
|
||||||
|
<dogs value="Some Dogs"/>
|
||||||
|
|
||||||
|
</CustomResource>
|
||||||
|
```
|
|
@ -0,0 +1,174 @@
|
||||||
|
# Profiles and Extensions
|
||||||
|
|
||||||
|
This page describes how to extend and constrain the FHIR data model for your own purposes.
|
||||||
|
|
||||||
|
# Extensions
|
||||||
|
|
||||||
|
<p class="doc_info_bubble">
|
||||||
|
Note on FHIR Versions: Because of the differences in the way the structures work between DSTU2 and DSTU3, we have provided two versions of many of the examples on this page. See the <a href="/hapi-fhir/download.html">download page</a> for more information on FHIR versions.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Extensions are a key part of the FHIR specification, providing a standardized way of placing additional data in a resource.
|
||||||
|
|
||||||
|
The simplest way to interact with extensions (i.e. to add them to resources you are creating, or to read them from resources you are consuming) is to treat them as "undeclared extensions". Undeclared extensions can be added to any of the built in FHIR resource types that come with HAPI-FHIR.
|
||||||
|
|
||||||
|
### DSTU2
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu2.java|resourceExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DSTU3 and Later
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|resourceExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Undeclared extensions can also be added to datatypes (composite or primitive).
|
||||||
|
|
||||||
|
### DSTU2
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu2.java|resourceStringExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DSTU3 and Later
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|resourceStringExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sub-Extensions
|
||||||
|
|
||||||
|
Extensions may also have child extensions as their content, instead of a datatype. This is done by adding a child undeclared extension to the parent extension.
|
||||||
|
|
||||||
|
### DSTU2
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu2.java|subExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DSTU3 and Later
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|subExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Retrieving Extension Values
|
||||||
|
|
||||||
|
HAPI provides a few ways of accessing extension values in resources which are received from other sources (i.e. downloaded by a client).
|
||||||
|
|
||||||
|
### DSTU2
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu2.java|parseExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DSTU3 and Later
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|parseExtension}}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Custom Resource Types
|
||||||
|
|
||||||
|
The most elegant way of adding extensions to a resource is through the use of custom fields. The following example shows a custom type which extends the FHIR Patient resource definition through two extensions.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/MyPatient.java|patientDef}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Using this custom type is as simple as instantiating the type and working with the new fields.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/MyPatientUse.java|patientUse}}
|
||||||
|
```
|
||||||
|
|
||||||
|
This example produces the following output:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Patient xmlns="http://hl7.org/fhir">
|
||||||
|
<modifierExtension url="http://example.com/dontuse#importantDates">
|
||||||
|
<valueDateTime value="2010-01-02"/>
|
||||||
|
</modifierExtension>
|
||||||
|
<modifierExtension url="http://example.com/dontuse#importantDates">
|
||||||
|
<valueDateTime value="2014-01-26T11:11:11"/>
|
||||||
|
</modifierExtension>
|
||||||
|
<extension url="http://example.com/dontuse#petname">
|
||||||
|
<valueString value="Fido"/>
|
||||||
|
</extension>
|
||||||
|
<name>
|
||||||
|
<family value="Smith"/>
|
||||||
|
<given value="John"/>
|
||||||
|
<given value="Quincy"/>
|
||||||
|
<suffix value="Jr"/>
|
||||||
|
</name>
|
||||||
|
</Patient>
|
||||||
|
```
|
||||||
|
|
||||||
|
Parsing messages using your new custom type is equally simple. These types can also be used as method return types in clients and servers.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/MyPatientUse.java|patientParse}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using Custom Types in a Client
|
||||||
|
|
||||||
|
If you are using a client and wish to use a specific custom structure, you may simply use the custom structure as you would a build in HAPI type.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|customTypeClientSimple}}
|
||||||
|
```
|
||||||
|
|
||||||
|
You may also explicitly use custom types in searches and other operations which return resources.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|customTypeClientSearch}}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also explicitly declare a preferred response resource custom type. This is useful for some operations that do not otherwise declare their resource types in the method signature.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|customTypeClientSearch2}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using Multiple Custom Types in a Client
|
||||||
|
|
||||||
|
Sometimes you may not know in advance exactly which type you will be receiving. For example, there are Patient resources which conform to several different profiles on a server and you aren't sure which profile you will get back for a specific read, you can declare the "primary" type for a given profile.
|
||||||
|
|
||||||
|
This is declared at the FhirContext level, and will apply to any clients created from this context (including clients created before the default was set).
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|customTypeClientDeclared}}
|
||||||
|
```
|
||||||
|
## Using Custom Types in a Server
|
||||||
|
|
||||||
|
If you are using a client and wish to use a specific custom structure, you may simply use the custom structure as you would a build in HAPI type.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ExtensionsDstu3.java|customTypeClientSimple}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom Type Examples: Composite Extensions
|
||||||
|
|
||||||
|
The following example shows a resource containing a composite extension.
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/customtype/CustomCompositeExtension.java|resource}}
|
||||||
|
```
|
||||||
|
|
||||||
|
This could be used to create a resource such as the following:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Patient xmlns="http://hl7.org/fhir">
|
||||||
|
<id value="123"/>
|
||||||
|
<extension url="http://acme.org/fooParent">
|
||||||
|
<extension url="http://acme.org/fooChildA">
|
||||||
|
<valueString value="ValueA"/>
|
||||||
|
</extension>
|
||||||
|
<extension url="http://acme.org/fooChildB">
|
||||||
|
<valueString value="ValueB"/>
|
||||||
|
</extension>
|
||||||
|
</extension>
|
||||||
|
</Patient>
|
||||||
|
```
|
|
@ -0,0 +1,94 @@
|
||||||
|
# CORS
|
||||||
|
|
||||||
|
<p class="doc_info_bubble">
|
||||||
|
Note that in previous revisions of this document we recommended using the <a href="https://github.com/ebay/cors-filter">eBay CORS Filter</a>, but as of 2016 the eBay filter is no longer being maintained and contains known bugs. We now recommend against using this filter.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
If you are intending to support JavaScript clients in your server application, you will generally need to enable Cross Origin Resource Sharing (CORS). There are a number of ways of supporting this, so two are shown here:
|
||||||
|
|
||||||
|
* An approach using a HAPI FHIR Server Interceptor (Requires SpringFramework)
|
||||||
|
* An approach using a servlet Filter (Container Specific)
|
||||||
|
|
||||||
|
## HAPI FHIR Server Interceptor
|
||||||
|
|
||||||
|
The HAPI FHIR server framework includes an interceptor that can be used to provide CORS functionality on your server. This mechanism is nice because it relies purely on Java configuration (no messing around with web.xml files). HAPI's interceptor is a thin wrapper around Spring Framework's CorsProcessor class, so it requires Spring to be present on your classpath.
|
||||||
|
|
||||||
|
Spring is generally unlikely to conflict with other libraries so it is usually safe to add it to your classpath, but it is a fairly large library so if size is a concern you might opt to use a filter instead.
|
||||||
|
|
||||||
|
The following steps outline how to enable HAPI's CorsInterceptor:
|
||||||
|
|
||||||
|
Add the following dependency to your POM. Note the exclusion of commons-logging, as we are using SLF4j without commons-logging in most of our examples. If your application uses commons-logging you don't need to exclude that dependency.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
<version>${spring_version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
In your server's initialization method, create and register a CorsInterceptor:
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/ServletExamples.java|corsInterceptor}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add the Dependency
|
||||||
|
|
||||||
|
The following examples show how to use the Apache Tomcat CorsFilter to enable CORS support. The filter being used (`org.apache.catalina.filters.CorsFilter`) is bundled with Apache Tomcat so if you are deploying to that server you can use the filter.
|
||||||
|
|
||||||
|
Other containers have similar filters you can use, so consult the documentation for the given container you are using for more information. (If you have an example for how to configure a different CORS filter, please send it our way! Examples are always useful!)
|
||||||
|
|
||||||
|
In your web.xml file (within the WEB-INF directory in your WAR file), the following filter definition adds the CORS filter, including support for the X-FHIR-Starter header defined by SMART Platforms.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<filter>
|
||||||
|
<filter-name>CORS Filter</filter-name>
|
||||||
|
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
|
||||||
|
<param-name>cors.allowed.origins</param-name>
|
||||||
|
<param-value>*</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>A comma separated list of HTTP verbs, using which a CORS request can be made.</description>
|
||||||
|
<param-name>cors.allowed.methods</param-name>
|
||||||
|
<param-value>GET,POST,PUT,DELETE,OPTIONS</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>A comma separated list of allowed headers when making a non simple CORS request.</description>
|
||||||
|
<param-name>cors.allowed.headers</param-name>
|
||||||
|
<param-value>X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>A comma separated list non-standard response headers that will be exposed to XHR2 object.</description>
|
||||||
|
<param-name>cors.exposed.headers</param-name>
|
||||||
|
<param-value>Location,Content-Location</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>A flag that suggests if CORS is supported with cookies</description>
|
||||||
|
<param-name>cors.support.credentials</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>A flag to control logging</description>
|
||||||
|
<param-name>cors.logging.enabled</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<description>Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.</description>
|
||||||
|
<param-name>cors.preflight.maxage</param-name>
|
||||||
|
<param-value>300</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>CORS Filter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>]]></source>
|
||||||
|
```
|
|
@ -0,0 +1,87 @@
|
||||||
|
|
||||||
|
# Command Line Tool for HAPI FHIR
|
||||||
|
|
||||||
|
**hapi-fhir-cli** is the HAPI FHIR Command Line tool. It features a number of HAPI's built-in features as easy to use command line options.
|
||||||
|
|
||||||
|
## Download and Installation
|
||||||
|
|
||||||
|
You can get the tool by downloading it from our [GitHub Releases](https://github.com/jamesagnew/hapi-fhir/releases) page (look for the archive named `hapi-fhir-[version]-cli.tar.bz2` on OSX/Linux or `hapi-fhir-[version]-cli.zip` on Windows).
|
||||||
|
|
||||||
|
When you have downloaded the archive (either ZIP or tar.bz2), expand it into a directory where you will keep it, and add this directory to your path.
|
||||||
|
|
||||||
|
You can now try the tool out by executing the following command: `hapi-fhir-cli`
|
||||||
|
|
||||||
|
This command should show a help screen, as shown in the screeenshot below.
|
||||||
|
|
||||||
|
<img src="/hapi-fhir/docs/images/hapi-fhir-cli.png" alt="Basic screen shot" style="margin-left: 40px;"/>
|
||||||
|
|
||||||
|
## Download and Installation - Mac/OSX
|
||||||
|
|
||||||
|
hapi-fhir-cli is available as a <a href="https://brew.sh/">Homebrew</a> package for Mac. It can be installed using the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install hapi-fhir-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
The tool should work correctly on any system that has Java 8 (or newer) installed. If it is not working correctly, first try the following command to test if Java is installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -version
|
||||||
|
```
|
||||||
|
|
||||||
|
If this command does not produce output similar to the following, you should install/reinstall Java.
|
||||||
|
|
||||||
|
```
|
||||||
|
java version "1.8.0_60"
|
||||||
|
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
|
||||||
|
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
|
||||||
|
```
|
||||||
|
If this does not help, please post a question on our [Google Group](https://groups.google.com/d/forum/hapi-fhir).
|
||||||
|
|
||||||
|
# Server (run-server)
|
||||||
|
|
||||||
|
The CLI tool can be used to start a local, fully functional FHIR server which you can use for testing. To start this server, simply issue the command <code>hapi-fhir-cli run-server</code> as shown in the example below:
|
||||||
|
|
||||||
|
<img src="/hapi-fhir/docs/images/hapi-fhir-cli-run-server.png" alt="Run Server" style="margin-left: 40px;"/>
|
||||||
|
|
||||||
|
Once the server has started, you can access the testing webpage by pointing your browser at <a href="http://localhost:8080/">http://localhost:8080/</a>. The FHIR server base URL will be <a href="http://localhost:8080/baseDstu2/">http://localhost:8080/baseDstu2/</a>.
|
||||||
|
|
||||||
|
Note that by default this server will not be populated with any resources at all. You can easily populate it with the FHIR example resources by <b>leaving it running</b> and opening a second terminal window, then using the <code>hapi-fhir-cli upload-examples</code> command (see the section below).
|
||||||
|
|
||||||
|
The server uses a local Derby database instance for storage. You may want to execute this command in an empty directory, which you can clear if you want to reset the server.
|
||||||
|
|
||||||
|
# Upload Example Resources (upload-examples)
|
||||||
|
|
||||||
|
The <b>upload-examples</b> command downloads the complete set of FHIR example resources from the HL7 website, and uploads them to a server of your choice. This can be useful to populate a server with test data.
|
||||||
|
|
||||||
|
To execute this command, uploading test resources to a local CLI server, issue the following: `hapi-fhir-cli upload-examples -t http://localhost:8080/baseDstu2`
|
||||||
|
|
||||||
|
Note that this command may take a surprisingly long time to complete because of the large number of examples.
|
||||||
|
|
||||||
|
# Upload Terminology
|
||||||
|
|
||||||
|
The HAPI FHIR JPA server has a terminology server, and has the ability to be populated with "external" code systems. These code systems are systems that contain large numbers of codes, so the codes are not stored directly inside the resource body.
|
||||||
|
|
||||||
|
HAPI has methods for uploading several popular code systems into its tables using the distribution files produced by the respective code systems. This is done using the <code>upload-terminology</code> command. The following examples show how to do this for several popular code systems.
|
||||||
|
|
||||||
|
Note that the path and exact filename of the terminology files will likely need to be adjusted for your local disk structure.
|
||||||
|
|
||||||
|
### SNOMED CT
|
||||||
|
|
||||||
|
```
|
||||||
|
./hapi-fhir-cli upload-terminology -d Downloads/SnomedCT_RF2Release_INT_20160131.zip -f dstu3 -t http://localhost:8080/baseDstu3 -u http://snomed.info/sct
|
||||||
|
```
|
||||||
|
|
||||||
|
### LOINC
|
||||||
|
|
||||||
|
```
|
||||||
|
./hapi-fhir-cli upload-terminology -d Downloads/LOINC_2.54_MULTI-AXIAL_HIERARCHY.zip -d Downloads/LOINC_2.54_Text.zip -f dstu3 -t http://localhost:8080/baseDstu3 -u http://loinc.org
|
||||||
|
```
|
||||||
|
|
||||||
|
# Migrate Database
|
||||||
|
|
||||||
|
The `migrate-database` command may be used to Migrate a database schema when upgrading a <a href="./doc_jpa.html">HAPI FHIR JPA</a> project from one version of HAPI FHIR to another version.
|
||||||
|
|
||||||
|
See <a href="./doc_jpa.html#upgrading">Upgrading HAPI FHIR JPA</a> for information on how to use this command.
|
|
@ -1293,7 +1293,7 @@ public class GenericClientTest {
|
||||||
|
|
||||||
assertThat(capt.getValue().getURI().toString(), containsString("http://example.com/fhir/Patient?"));
|
assertThat(capt.getValue().getURI().toString(), containsString("http://example.com/fhir/Patient?"));
|
||||||
assertThat(capt.getValue().getURI().toString(), containsString("_include=" + UrlUtil.escapeUrlParam(Patient.INCLUDE_ORGANIZATION.getValue())));
|
assertThat(capt.getValue().getURI().toString(), containsString("_include=" + UrlUtil.escapeUrlParam(Patient.INCLUDE_ORGANIZATION.getValue())));
|
||||||
assertThat(capt.getValue().getURI().toString(), containsString("_include%3Arecurse=" + UrlUtil.escapeUrlParam(Patient.INCLUDE_LINK.getValue())));
|
assertThat(capt.getValue().getURI().toString(), containsString("_include%3Aiterate=" + UrlUtil.escapeUrlParam(Patient.INCLUDE_LINK.getValue())));
|
||||||
assertThat(capt.getValue().getURI().toString(), containsString("_include=*"));
|
assertThat(capt.getValue().getURI().toString(), containsString("_include=*"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
|
<!-- This content is migrated -->
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<title>Android Support</title>
|
<title>Android Support</title>
|
||||||
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
|
<!-- This content is migrated -->
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<title>Command Line Tool</title>
|
<title>Command Line Tool</title>
|
||||||
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
||||||
|
|
|
@ -1,74 +1,76 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
<properties>
|
<!-- This content is migrated -->
|
||||||
<title>HL7 FHIR Converter</title>
|
|
||||||
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
<properties>
|
||||||
</properties>
|
<title>HL7 FHIR Converter</title>
|
||||||
|
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
|
||||||
<body>
|
</properties>
|
||||||
|
|
||||||
<section name="HL7 FHIR Converter">
|
<body>
|
||||||
|
|
||||||
<macro name="toc">
|
<section name="HL7 FHIR Converter">
|
||||||
</macro>
|
|
||||||
|
<macro name="toc">
|
||||||
<p>
|
</macro>
|
||||||
Beginning in HAPI FHIR 2.3, a new experimental feature called
|
|
||||||
<code>hapi-fhir-converter</code> has been added to the project. This
|
<p>
|
||||||
is an <b>experimental feature</b> so use it with caution!
|
Beginning in HAPI FHIR 2.3, a new experimental feature called
|
||||||
</p>
|
<code>hapi-fhir-converter</code> has been added to the project. This
|
||||||
|
is an <b>experimental feature</b> so use it with caution!
|
||||||
<p>
|
</p>
|
||||||
This feature allows automated conversion from earlier versions
|
|
||||||
of the FHIR structures to a later version.
|
<p>
|
||||||
</p>
|
This feature allows automated conversion from earlier versions
|
||||||
|
of the FHIR structures to a later version.
|
||||||
<p>
|
</p>
|
||||||
The following page shows some basic examples. Please get in touch
|
|
||||||
if you are able to contribute better examples!
|
<p>
|
||||||
</p>
|
The following page shows some basic examples. Please get in touch
|
||||||
|
if you are able to contribute better examples!
|
||||||
<subsection name="Importing the Module">
|
</p>
|
||||||
<p>
|
|
||||||
To use the <code>hapi-fhir-converter</code> module, import the following
|
<subsection name="Importing the Module">
|
||||||
dependency into your project pom.xml (or equivalent)
|
<p>
|
||||||
</p>
|
To use the <code>hapi-fhir-converter</code> module, import the following
|
||||||
<source><![CDATA[<dependency>
|
dependency into your project pom.xml (or equivalent)
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
</p>
|
||||||
<artifactId>hapi-fhir-converter</artifactId>
|
<source><![CDATA[<dependency>
|
||||||
<version>${project.version}</version>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
</dependency>]]></source>
|
<artifactId>hapi-fhir-converter</artifactId>
|
||||||
</subsection>
|
<version>${project.version}</version>
|
||||||
|
</dependency>]]></source>
|
||||||
<subsection name="Converting from DSTU2 to DSTU3">
|
</subsection>
|
||||||
<p>
|
|
||||||
The following example shows a conversion from a
|
<subsection name="Converting from DSTU2 to DSTU3">
|
||||||
<code>hapi-fhir-structures-hl7org-dstu2</code>
|
<p>
|
||||||
structure to a
|
The following example shows a conversion from a
|
||||||
<code>hapi-fhir-structures-dstu3</code> structure.
|
<code>hapi-fhir-structures-hl7org-dstu2</code>
|
||||||
</p>
|
structure to a
|
||||||
<macro name="snippet">
|
<code>hapi-fhir-structures-dstu3</code> structure.
|
||||||
<param name="id" value="1020"/>
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ConverterExamples.java"/>
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="1020"/>
|
||||||
</subsection>
|
<param name="file" value="examples/src/main/java/example/ConverterExamples.java"/>
|
||||||
|
</macro>
|
||||||
<subsection name="Converting from DSTU2.1 to DSTU3">
|
</subsection>
|
||||||
<p>
|
|
||||||
The following example shows a conversion from a
|
<subsection name="Converting from DSTU2.1 to DSTU3">
|
||||||
<code>hapi-fhir-structures-dstu2.1</code>
|
<p>
|
||||||
structure to a
|
The following example shows a conversion from a
|
||||||
<code>hapi-fhir-structures-dstu3</code> structure.
|
<code>hapi-fhir-structures-dstu2.1</code>
|
||||||
</p>
|
structure to a
|
||||||
<macro name="snippet">
|
<code>hapi-fhir-structures-dstu3</code> structure.
|
||||||
<param name="id" value="1420"/>
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ConverterExamples.java"/>
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="1420"/>
|
||||||
</subsection>
|
<param name="file" value="examples/src/main/java/example/ConverterExamples.java"/>
|
||||||
|
</macro>
|
||||||
</section>
|
</subsection>
|
||||||
|
|
||||||
</body>
|
</section>
|
||||||
|
|
||||||
</document>
|
</body>
|
||||||
|
|
||||||
|
</document>
|
||||||
|
|
|
@ -1,151 +1,153 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
<properties>
|
<!-- This has been migrated -->
|
||||||
<title>CORS</title>
|
|
||||||
<author email="jamesagnew@gmail.com">James Agnew</author>
|
<properties>
|
||||||
</properties>
|
<title>CORS</title>
|
||||||
|
<author email="jamesagnew@gmail.com">James Agnew</author>
|
||||||
<body>
|
</properties>
|
||||||
|
|
||||||
<section name="CORS">
|
<body>
|
||||||
|
|
||||||
<p class="doc_info_bubble">
|
<section name="CORS">
|
||||||
Note that in previous revisions of this document we recommended using the
|
|
||||||
<a href="https://github.com/ebay/cors-filter">eBay CORS Filter</a>, but
|
<p class="doc_info_bubble">
|
||||||
as of 2016 the eBay filter is no longer being maintained and contains known bugs.
|
Note that in previous revisions of this document we recommended using the
|
||||||
We now recommend against using this filter.
|
<a href="https://github.com/ebay/cors-filter">eBay CORS Filter</a>, but
|
||||||
</p>
|
as of 2016 the eBay filter is no longer being maintained and contains known bugs.
|
||||||
|
We now recommend against using this filter.
|
||||||
<p>
|
</p>
|
||||||
If you are intending to support JavaScript clients in your server application,
|
|
||||||
you will generally need to enable Cross Origin Resource Sharing (CORS). There are
|
<p>
|
||||||
a number of ways of supporting this, so two are shown here:
|
If you are intending to support JavaScript clients in your server application,
|
||||||
</p>
|
you will generally need to enable Cross Origin Resource Sharing (CORS). There are
|
||||||
<ul>
|
a number of ways of supporting this, so two are shown here:
|
||||||
<li>An approach using a HAPI FHIR Server Interceptor (Requires SpringFramework)</li>
|
</p>
|
||||||
<li>An approach using a servlet Filter (Container Specific)</li>
|
<ul>
|
||||||
</ul>
|
<li>An approach using a HAPI FHIR Server Interceptor (Requires SpringFramework)</li>
|
||||||
|
<li>An approach using a servlet Filter (Container Specific)</li>
|
||||||
<subsection name="HAPI FHIR Server Interceptor">
|
</ul>
|
||||||
|
|
||||||
<p>
|
<subsection name="HAPI FHIR Server Interceptor">
|
||||||
The HAPI FHIR server framework includes an interceptor that can be
|
|
||||||
used to provide CORS functionality on your server. This mechanism is
|
<p>
|
||||||
nice because it relies purely on Java configuration (no messing around with
|
The HAPI FHIR server framework includes an interceptor that can be
|
||||||
web.xml files). HAPI's interceptor is a thin wrapper around Spring Framework's
|
used to provide CORS functionality on your server. This mechanism is
|
||||||
CorsProcessor class, so it requires Spring to be present on your classpath.
|
nice because it relies purely on Java configuration (no messing around with
|
||||||
</p>
|
web.xml files). HAPI's interceptor is a thin wrapper around Spring Framework's
|
||||||
|
CorsProcessor class, so it requires Spring to be present on your classpath.
|
||||||
<p>
|
</p>
|
||||||
Spring is generally unlikely to conflict with other libraries so it is usually
|
|
||||||
safe to add it to your classpath, but it is a fairly large library so if size is
|
<p>
|
||||||
a concern you might opt to use a filter instead.
|
Spring is generally unlikely to conflict with other libraries so it is usually
|
||||||
</p>
|
safe to add it to your classpath, but it is a fairly large library so if size is
|
||||||
|
a concern you might opt to use a filter instead.
|
||||||
<p>
|
</p>
|
||||||
The following steps outline how to enable HAPI's CorsInterceptor:
|
|
||||||
</p>
|
<p>
|
||||||
|
The following steps outline how to enable HAPI's CorsInterceptor:
|
||||||
<p>
|
</p>
|
||||||
Add the following dependency to your POM. Note the exclusion of
|
|
||||||
commons-logging, as we are using SLF4j without commons-logging in
|
<p>
|
||||||
most of our examples. If your application uses commons-logging you don't need
|
Add the following dependency to your POM. Note the exclusion of
|
||||||
to exclude that dependency.
|
commons-logging, as we are using SLF4j without commons-logging in
|
||||||
</p>
|
most of our examples. If your application uses commons-logging you don't need
|
||||||
<source><![CDATA[<dependency>
|
to exclude that dependency.
|
||||||
<groupId>org.springframework</groupId>
|
</p>
|
||||||
<artifactId>spring-web</artifactId>
|
<source><![CDATA[<dependency>
|
||||||
<version>${spring_version}</version>
|
<groupId>org.springframework</groupId>
|
||||||
<exclusions>
|
<artifactId>spring-web</artifactId>
|
||||||
<exclusion>
|
<version>${spring_version}</version>
|
||||||
<artifactId>commons-logging</artifactId>
|
<exclusions>
|
||||||
<groupId>commons-logging</groupId>
|
<exclusion>
|
||||||
</exclusion>
|
<artifactId>commons-logging</artifactId>
|
||||||
</exclusions>
|
<groupId>commons-logging</groupId>
|
||||||
</dependency>]]></source>
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
<p>
|
</dependency>]]></source>
|
||||||
In your server's initialization method, create and register
|
|
||||||
a CorsInterceptor:
|
<p>
|
||||||
</p>
|
In your server's initialization method, create and register
|
||||||
<macro name="snippet">
|
a CorsInterceptor:
|
||||||
<param name="id" value="corsInterceptor" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ServletExamples.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="corsInterceptor" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ServletExamples.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Add the Dependency">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Add the Dependency">
|
||||||
The following examples show how to use the Apache Tomcat CorsFilter to enable
|
|
||||||
CORS support. The filter being used
|
<p>
|
||||||
(<code>org.apache.catalina.filters.CorsFilter</code>) is bundled with Apache
|
The following examples show how to use the Apache Tomcat CorsFilter to enable
|
||||||
Tomcat so if you are deploying to that server you can use the filter.
|
CORS support. The filter being used
|
||||||
</p>
|
(<code>org.apache.catalina.filters.CorsFilter</code>) is bundled with Apache
|
||||||
|
Tomcat so if you are deploying to that server you can use the filter.
|
||||||
<p>
|
</p>
|
||||||
Other containers have similar filters you can use, so consult the documentation
|
|
||||||
for the given container you are using for more information. (If you have
|
<p>
|
||||||
an example for how to configure a different CORS filter, please send it
|
Other containers have similar filters you can use, so consult the documentation
|
||||||
our way! Examples are always useful!)
|
for the given container you are using for more information. (If you have
|
||||||
</p>
|
an example for how to configure a different CORS filter, please send it
|
||||||
|
our way! Examples are always useful!)
|
||||||
<p>
|
</p>
|
||||||
In your web.xml file (within the WEB-INF directory in your WAR file),
|
|
||||||
the following filter definition adds the CORS filter, including support
|
<p>
|
||||||
for the X-FHIR-Starter header defined by SMART Platforms.
|
In your web.xml file (within the WEB-INF directory in your WAR file),
|
||||||
</p>
|
the following filter definition adds the CORS filter, including support
|
||||||
|
for the X-FHIR-Starter header defined by SMART Platforms.
|
||||||
<source><![CDATA[<filter>
|
</p>
|
||||||
<filter-name>CORS Filter</filter-name>
|
|
||||||
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
|
<source><![CDATA[<filter>
|
||||||
<init-param>
|
<filter-name>CORS Filter</filter-name>
|
||||||
<description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
|
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
|
||||||
<param-name>cors.allowed.origins</param-name>
|
<init-param>
|
||||||
<param-value>*</param-value>
|
<description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
|
||||||
</init-param>
|
<param-name>cors.allowed.origins</param-name>
|
||||||
<init-param>
|
<param-value>*</param-value>
|
||||||
<description>A comma separated list of HTTP verbs, using which a CORS request can be made.</description>
|
</init-param>
|
||||||
<param-name>cors.allowed.methods</param-name>
|
<init-param>
|
||||||
<param-value>GET,POST,PUT,DELETE,OPTIONS</param-value>
|
<description>A comma separated list of HTTP verbs, using which a CORS request can be made.</description>
|
||||||
</init-param>
|
<param-name>cors.allowed.methods</param-name>
|
||||||
<init-param>
|
<param-value>GET,POST,PUT,DELETE,OPTIONS</param-value>
|
||||||
<description>A comma separated list of allowed headers when making a non simple CORS request.</description>
|
</init-param>
|
||||||
<param-name>cors.allowed.headers</param-name>
|
<init-param>
|
||||||
<param-value>X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
|
<description>A comma separated list of allowed headers when making a non simple CORS request.</description>
|
||||||
</init-param>
|
<param-name>cors.allowed.headers</param-name>
|
||||||
<init-param>
|
<param-value>X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>
|
||||||
<description>A comma separated list non-standard response headers that will be exposed to XHR2 object.</description>
|
</init-param>
|
||||||
<param-name>cors.exposed.headers</param-name>
|
<init-param>
|
||||||
<param-value>Location,Content-Location</param-value>
|
<description>A comma separated list non-standard response headers that will be exposed to XHR2 object.</description>
|
||||||
</init-param>
|
<param-name>cors.exposed.headers</param-name>
|
||||||
<init-param>
|
<param-value>Location,Content-Location</param-value>
|
||||||
<description>A flag that suggests if CORS is supported with cookies</description>
|
</init-param>
|
||||||
<param-name>cors.support.credentials</param-name>
|
<init-param>
|
||||||
<param-value>true</param-value>
|
<description>A flag that suggests if CORS is supported with cookies</description>
|
||||||
</init-param>
|
<param-name>cors.support.credentials</param-name>
|
||||||
<init-param>
|
<param-value>true</param-value>
|
||||||
<description>A flag to control logging</description>
|
</init-param>
|
||||||
<param-name>cors.logging.enabled</param-name>
|
<init-param>
|
||||||
<param-value>true</param-value>
|
<description>A flag to control logging</description>
|
||||||
</init-param>
|
<param-name>cors.logging.enabled</param-name>
|
||||||
<init-param>
|
<param-value>true</param-value>
|
||||||
<description>Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.</description>
|
</init-param>
|
||||||
<param-name>cors.preflight.maxage</param-name>
|
<init-param>
|
||||||
<param-value>300</param-value>
|
<description>Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.</description>
|
||||||
</init-param>
|
<param-name>cors.preflight.maxage</param-name>
|
||||||
</filter>
|
<param-value>300</param-value>
|
||||||
<filter-mapping>
|
</init-param>
|
||||||
<filter-name>CORS Filter</filter-name>
|
</filter>
|
||||||
<url-pattern>/*</url-pattern>
|
<filter-mapping>
|
||||||
</filter-mapping>]]></source>
|
<filter-name>CORS Filter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
</subsection>
|
</filter-mapping>]]></source>
|
||||||
|
|
||||||
</section>
|
</subsection>
|
||||||
|
|
||||||
</body>
|
</section>
|
||||||
|
|
||||||
</document>
|
</body>
|
||||||
|
|
||||||
|
</document>
|
||||||
|
|
|
@ -1,95 +1,97 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
<properties>
|
<!-- This has been migrated -->
|
||||||
<title>Custom Structures</title>
|
|
||||||
</properties>
|
<properties>
|
||||||
|
<title>Custom Structures</title>
|
||||||
<body>
|
</properties>
|
||||||
|
|
||||||
<section name="Custom Structures">
|
<body>
|
||||||
|
|
||||||
<p>
|
<section name="Custom Structures">
|
||||||
Typically, when working with FHIR the right way to provide your
|
|
||||||
own extensions is to work with existing resource types and simply
|
<p>
|
||||||
add your own extensions and/or constrain out fields you don't
|
Typically, when working with FHIR the right way to provide your
|
||||||
need.
|
own extensions is to work with existing resource types and simply
|
||||||
</p>
|
add your own extensions and/or constrain out fields you don't
|
||||||
<p>
|
need.
|
||||||
This process is described on the
|
</p>
|
||||||
<a href="./doc_extensions.html">Profiles & Extensions</a>
|
<p>
|
||||||
page.
|
This process is described on the
|
||||||
</p>
|
<a href="./doc_extensions.html">Profiles & Extensions</a>
|
||||||
<p>
|
page.
|
||||||
There are situations however when you might want to create an
|
</p>
|
||||||
entirely custom resource type. This feature should be used
|
<p>
|
||||||
only if there is no other option, since it means you are creating
|
There are situations however when you might want to create an
|
||||||
a resource type that will not be interoperable with other FHIR
|
entirely custom resource type. This feature should be used
|
||||||
implementations.
|
only if there is no other option, since it means you are creating
|
||||||
</p>
|
a resource type that will not be interoperable with other FHIR
|
||||||
<p class="doc_info_bubble">
|
implementations.
|
||||||
This is an advanced features and isn't needed for most uses of
|
</p>
|
||||||
HAPI-FHIR. Feel free to skip this page.
|
<p class="doc_info_bubble">
|
||||||
</p>
|
This is an advanced features and isn't needed for most uses of
|
||||||
|
HAPI-FHIR. Feel free to skip this page.
|
||||||
<subsection name="Custom Resource Structure">
|
</p>
|
||||||
|
|
||||||
<p>
|
<subsection name="Custom Resource Structure">
|
||||||
The following example shows a custom resource structure
|
|
||||||
class:
|
<p>
|
||||||
</p>
|
The following example shows a custom resource structure
|
||||||
<macro name="snippet">
|
class:
|
||||||
<param name="id" value="resource" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/customtype/CustomResource.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resource" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/customtype/CustomResource.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Custom Datatype Structure">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Custom Datatype Structure">
|
||||||
The following example shows a custom datatype structure
|
|
||||||
class:
|
<p>
|
||||||
</p>
|
The following example shows a custom datatype structure
|
||||||
<macro name="snippet">
|
class:
|
||||||
<param name="id" value="datatype" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/customtype/CustomDatatype.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="datatype" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/customtype/CustomDatatype.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Using the Custom Structure">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Using the Custom Structure">
|
||||||
And now let's try the custom structure out:
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
And now let's try the custom structure out:
|
||||||
<param name="id" value="usage" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/customtype/CustomUsage.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="usage" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/customtype/CustomUsage.java" />
|
||||||
<p>
|
</macro>
|
||||||
This produces the following output (some spacing has been added for readability):
|
|
||||||
</p>
|
<p>
|
||||||
<source><![CDATA[<CustomResource xmlns="http://hl7.org/fhir">
|
This produces the following output (some spacing has been added for readability):
|
||||||
<meta>
|
</p>
|
||||||
<profile value="http://hl7.org/fhir/profiles/custom-resource"/>
|
<source><![CDATA[<CustomResource xmlns="http://hl7.org/fhir">
|
||||||
</meta>
|
<meta>
|
||||||
|
<profile value="http://hl7.org/fhir/profiles/custom-resource"/>
|
||||||
<televisionDate value="2015-01-01"/>
|
</meta>
|
||||||
<televisionCustomDatatype>
|
|
||||||
<date value="2016-05-22T08:30:36-04:00"/>
|
<televisionDate value="2015-01-01"/>
|
||||||
<kittens value="FOO"/>
|
<televisionCustomDatatype>
|
||||||
</televisionCustomDatatype>
|
<date value="2016-05-22T08:30:36-04:00"/>
|
||||||
|
<kittens value="FOO"/>
|
||||||
<dogs value="Some Dogs"/>
|
</televisionCustomDatatype>
|
||||||
|
|
||||||
</CustomResource>]]></source>
|
<dogs value="Some Dogs"/>
|
||||||
|
|
||||||
</subsection>
|
</CustomResource>]]></source>
|
||||||
|
|
||||||
</section>
|
</subsection>
|
||||||
|
|
||||||
</body>
|
</section>
|
||||||
|
|
||||||
</document>
|
</body>
|
||||||
|
|
||||||
|
</document>
|
||||||
|
|
|
@ -1,278 +1,280 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
|
||||||
|
|
||||||
<properties>
|
<!-- This content has been migrated -->
|
||||||
<title>Profiles and Extensions</title>
|
|
||||||
<author email="jamesagnew@gmail.com">James Agnew</author>
|
<properties>
|
||||||
</properties>
|
<title>Profiles and Extensions</title>
|
||||||
|
<author email="jamesagnew@gmail.com">James Agnew</author>
|
||||||
<body>
|
</properties>
|
||||||
|
|
||||||
<section name="Undeclared Extensions">
|
<body>
|
||||||
|
|
||||||
<p class="doc_info_bubble">
|
<section name="Undeclared Extensions">
|
||||||
Note on FHIR Versions: Because of the differences in the way the structures
|
|
||||||
work between DSTU2 and DSTU3, we have provided two versions of many of the
|
<p class="doc_info_bubble">
|
||||||
examples on this page. See the <a href="./download.html">download page</a>
|
Note on FHIR Versions: Because of the differences in the way the structures
|
||||||
for more information on FHIR versions.
|
work between DSTU2 and DSTU3, we have provided two versions of many of the
|
||||||
</p>
|
examples on this page. See the <a href="./download.html">download page</a>
|
||||||
|
for more information on FHIR versions.
|
||||||
<p>
|
</p>
|
||||||
Extensions are a key part of the FHIR specification, providing a standardized
|
|
||||||
way of placing additional data in a resource.
|
<p>
|
||||||
</p>
|
Extensions are a key part of the FHIR specification, providing a standardized
|
||||||
|
way of placing additional data in a resource.
|
||||||
<p>
|
</p>
|
||||||
The simplest way to interact with extensions (i.e. to add them to resources you are creating, or
|
|
||||||
to read them from resources you are consuming) is to treat them as "undeclared extensions".
|
<p>
|
||||||
Undeclared extensions can be added to any of the built in FHIR resource types that come with HAPI-FHIR.
|
The simplest way to interact with extensions (i.e. to add them to resources you are creating, or
|
||||||
</p>
|
to read them from resources you are consuming) is to treat them as "undeclared extensions".
|
||||||
|
Undeclared extensions can be added to any of the built in FHIR resource types that come with HAPI-FHIR.
|
||||||
<p>
|
</p>
|
||||||
<b>DSTU2</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU2</b>
|
||||||
<param name="id" value="resourceExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resourceExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
||||||
<p>
|
</macro>
|
||||||
<b>DSTU3</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU3</b>
|
||||||
<param name="id" value="resourceExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resourceExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
<p>
|
</macro>
|
||||||
Undeclared extensions can also be added to datatypes (composite or primitive).
|
|
||||||
</p>
|
<p>
|
||||||
|
Undeclared extensions can also be added to datatypes (composite or primitive).
|
||||||
<p>
|
</p>
|
||||||
<b>DSTU2</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU2</b>
|
||||||
<param name="id" value="resourceStringExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resourceStringExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
||||||
<p>
|
</macro>
|
||||||
<b>DSTU3</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU3</b>
|
||||||
<param name="id" value="resourceStringExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resourceStringExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
<subsection name="Sub-Extensions">
|
</macro>
|
||||||
|
|
||||||
<p>
|
<subsection name="Sub-Extensions">
|
||||||
Extensions may also have child extensions as their content, instead
|
|
||||||
of a datatype. This is done by adding a child undeclared extension to the
|
<p>
|
||||||
parent extension.
|
Extensions may also have child extensions as their content, instead
|
||||||
</p>
|
of a datatype. This is done by adding a child undeclared extension to the
|
||||||
|
parent extension.
|
||||||
<p>
|
</p>
|
||||||
<b>DSTU2</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU2</b>
|
||||||
<param name="id" value="subExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="subExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
||||||
<p>
|
</macro>
|
||||||
<b>DSTU3</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU3</b>
|
||||||
<param name="id" value="subExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="subExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Retrieving Extension Values">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Retrieving Extension Values">
|
||||||
HAPI provides a few ways of accessing extension values in resources
|
|
||||||
which are received from other sources (i.e. downloaded by a client).
|
<p>
|
||||||
</p>
|
HAPI provides a few ways of accessing extension values in resources
|
||||||
|
which are received from other sources (i.e. downloaded by a client).
|
||||||
<p>
|
</p>
|
||||||
<b>DSTU2</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU2</b>
|
||||||
<param name="id" value="parseExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="parseExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu2.java" />
|
||||||
<p>
|
</macro>
|
||||||
<b>DSTU3</b>
|
|
||||||
</p>
|
<p>
|
||||||
<macro name="snippet">
|
<b>DSTU3</b>
|
||||||
<param name="id" value="parseExtension" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="parseExtension" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
</section>
|
</subsection>
|
||||||
|
|
||||||
<section name="Custom Resource Types">
|
</section>
|
||||||
|
|
||||||
<p>
|
<section name="Custom Resource Types">
|
||||||
The most elegant way of adding extensions to a resource is through the
|
|
||||||
use of custom fields. The following example shows a custom type which
|
<p>
|
||||||
extends the FHIR Patient resource definition through two extensions.
|
The most elegant way of adding extensions to a resource is through the
|
||||||
</p>
|
use of custom fields. The following example shows a custom type which
|
||||||
|
extends the FHIR Patient resource definition through two extensions.
|
||||||
<macro name="snippet">
|
</p>
|
||||||
<param name="id" value="patientDef" />
|
|
||||||
<param name="file" value="examples/src/main/java/example/MyPatient.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="patientDef" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/MyPatient.java" />
|
||||||
<p>
|
</macro>
|
||||||
Using this custom type is as simple as instantiating the type
|
|
||||||
and working with the new fields.
|
<p>
|
||||||
</p>
|
Using this custom type is as simple as instantiating the type
|
||||||
|
and working with the new fields.
|
||||||
<macro name="snippet">
|
</p>
|
||||||
<param name="id" value="patientUse" />
|
|
||||||
<param name="file" value="examples/src/main/java/example/MyPatientUse.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="patientUse" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/MyPatientUse.java" />
|
||||||
<p>
|
</macro>
|
||||||
This example produces the following output:
|
|
||||||
</p>
|
<p>
|
||||||
|
This example produces the following output:
|
||||||
<source><![CDATA[<Patient xmlns="http://hl7.org/fhir">
|
</p>
|
||||||
<modifierExtension url="http://example.com/dontuse#importantDates">
|
|
||||||
<valueDateTime value="2010-01-02"/>
|
<source><![CDATA[<Patient xmlns="http://hl7.org/fhir">
|
||||||
</modifierExtension>
|
<modifierExtension url="http://example.com/dontuse#importantDates">
|
||||||
<modifierExtension url="http://example.com/dontuse#importantDates">
|
<valueDateTime value="2010-01-02"/>
|
||||||
<valueDateTime value="2014-01-26T11:11:11"/>
|
</modifierExtension>
|
||||||
</modifierExtension>
|
<modifierExtension url="http://example.com/dontuse#importantDates">
|
||||||
<extension url="http://example.com/dontuse#petname">
|
<valueDateTime value="2014-01-26T11:11:11"/>
|
||||||
<valueString value="Fido"/>
|
</modifierExtension>
|
||||||
</extension>
|
<extension url="http://example.com/dontuse#petname">
|
||||||
<name>
|
<valueString value="Fido"/>
|
||||||
<family value="Smith"/>
|
</extension>
|
||||||
<given value="John"/>
|
<name>
|
||||||
<given value="Quincy"/>
|
<family value="Smith"/>
|
||||||
<suffix value="Jr"/>
|
<given value="John"/>
|
||||||
</name>
|
<given value="Quincy"/>
|
||||||
</Patient>]]></source>
|
<suffix value="Jr"/>
|
||||||
|
</name>
|
||||||
<p>
|
</Patient>]]></source>
|
||||||
Parsing messages using your new custom type is equally simple.
|
|
||||||
These types can also be used as method return types in clients
|
<p>
|
||||||
and servers.
|
Parsing messages using your new custom type is equally simple.
|
||||||
</p>
|
These types can also be used as method return types in clients
|
||||||
|
and servers.
|
||||||
<macro name="snippet">
|
</p>
|
||||||
<param name="id" value="patientParse" />
|
|
||||||
<param name="file" value="examples/src/main/java/example/MyPatientUse.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="patientParse" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/MyPatientUse.java" />
|
||||||
<subsection name="Using Custom Types in a Client">
|
</macro>
|
||||||
|
|
||||||
<p>
|
<subsection name="Using Custom Types in a Client">
|
||||||
If you are using a client and wish to use a specific custom structure,
|
|
||||||
you may simply use the custom structure as you would a build in
|
<p>
|
||||||
HAPI type.
|
If you are using a client and wish to use a specific custom structure,
|
||||||
</p>
|
you may simply use the custom structure as you would a build in
|
||||||
<macro name="snippet">
|
HAPI type.
|
||||||
<param name="id" value="customTypeClientSimple" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="customTypeClientSimple" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
<p>
|
</macro>
|
||||||
You may also explicitly use custom types in searches and other
|
|
||||||
operations which return resources.
|
<p>
|
||||||
</p>
|
You may also explicitly use custom types in searches and other
|
||||||
<macro name="snippet">
|
operations which return resources.
|
||||||
<param name="id" value="customTypeClientSearch" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="customTypeClientSearch" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
<p>
|
</macro>
|
||||||
You can also explicitly declare a preferred response resource custom
|
|
||||||
type. This is useful for some operations that do not otherwise
|
<p>
|
||||||
declare their resource types in the method signature.
|
You can also explicitly declare a preferred response resource custom
|
||||||
</p>
|
type. This is useful for some operations that do not otherwise
|
||||||
<macro name="snippet">
|
declare their resource types in the method signature.
|
||||||
<param name="id" value="customTypeClientSearch2" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="customTypeClientSearch2" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Using Multiple Custom Types in a Client">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Using Multiple Custom Types in a Client">
|
||||||
Sometimes you may not know in advance exactly which
|
|
||||||
type you will be receiving. For example, there are Patient resources
|
<p>
|
||||||
which conform to several different profiles on a server and you
|
Sometimes you may not know in advance exactly which
|
||||||
aren't sure which profile you will get back for a specific read,
|
type you will be receiving. For example, there are Patient resources
|
||||||
you can declare the "primary" type for a given profile.
|
which conform to several different profiles on a server and you
|
||||||
</p>
|
aren't sure which profile you will get back for a specific read,
|
||||||
<p>
|
you can declare the "primary" type for a given profile.
|
||||||
This is declared at the FhirContext level, and will apply to any
|
</p>
|
||||||
clients created from this context (including clients created before
|
<p>
|
||||||
the default was set).
|
This is declared at the FhirContext level, and will apply to any
|
||||||
</p>
|
clients created from this context (including clients created before
|
||||||
<macro name="snippet">
|
the default was set).
|
||||||
<param name="id" value="customTypeClientDeclared" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="customTypeClientDeclared" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Using Custom Types in a Server">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Using Custom Types in a Server">
|
||||||
If you are using a client and wish to use a specific custom structure,
|
|
||||||
you may simply use the custom structure as you would a build in
|
<p>
|
||||||
HAPI type.
|
If you are using a client and wish to use a specific custom structure,
|
||||||
</p>
|
you may simply use the custom structure as you would a build in
|
||||||
<macro name="snippet">
|
HAPI type.
|
||||||
<param name="id" value="customTypeClientSimple" />
|
</p>
|
||||||
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="customTypeClientSimple" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/ExtensionsDstu3.java" />
|
||||||
</subsection>
|
</macro>
|
||||||
|
|
||||||
<subsection name="Custom Type Examples: Composite Extensions">
|
</subsection>
|
||||||
|
|
||||||
<p>
|
<subsection name="Custom Type Examples: Composite Extensions">
|
||||||
The following example shows a resource containing a composite
|
|
||||||
extension.
|
<p>
|
||||||
</p>
|
The following example shows a resource containing a composite
|
||||||
|
extension.
|
||||||
<macro name="snippet">
|
</p>
|
||||||
<param name="id" value="resource" />
|
|
||||||
<param name="file" value="examples/src/main/java/example/customtype/CustomCompositeExtension.java" />
|
<macro name="snippet">
|
||||||
</macro>
|
<param name="id" value="resource" />
|
||||||
|
<param name="file" value="examples/src/main/java/example/customtype/CustomCompositeExtension.java" />
|
||||||
<p>
|
</macro>
|
||||||
This could be used to create a resource such as the
|
|
||||||
following:
|
<p>
|
||||||
</p>
|
This could be used to create a resource such as the
|
||||||
<source><![CDATA[<Patient xmlns="http://hl7.org/fhir">
|
following:
|
||||||
<id value="123"/>
|
</p>
|
||||||
<extension url="http://acme.org/fooParent">
|
<source><![CDATA[<Patient xmlns="http://hl7.org/fhir">
|
||||||
<extension url="http://acme.org/fooChildA">
|
<id value="123"/>
|
||||||
<valueString value="ValueA"/>
|
<extension url="http://acme.org/fooParent">
|
||||||
</extension>
|
<extension url="http://acme.org/fooChildA">
|
||||||
<extension url="http://acme.org/fooChildB">
|
<valueString value="ValueA"/>
|
||||||
<valueString value="ValueB"/>
|
</extension>
|
||||||
</extension>
|
<extension url="http://acme.org/fooChildB">
|
||||||
</extension>
|
<valueString value="ValueB"/>
|
||||||
</Patient>]]></source>
|
</extension>
|
||||||
|
</extension>
|
||||||
</subsection>
|
</Patient>]]></source>
|
||||||
|
|
||||||
</section>
|
</subsection>
|
||||||
|
|
||||||
</body>
|
</section>
|
||||||
|
|
||||||
</document>
|
</body>
|
||||||
|
|
||||||
|
</document>
|
||||||
|
|