Documentation updates

This commit is contained in:
James Agnew 2015-06-12 17:50:01 -04:00
parent a46890b0d2
commit 0cc53ca742
7 changed files with 115 additions and 7 deletions

View File

@ -24,6 +24,11 @@
<artifactId>hapi-fhir-structures-dstu2</artifactId> <artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1-SNAPSHOT</version> <version>1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>

View File

@ -14,11 +14,33 @@ public class FhirContextIntro {
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static void creatingContext() { public static void creatingContext() {
// START SNIPPET: creatingContext // START SNIPPET: creatingContext
// Create a context for DSTU1
FhirContext ctx = FhirContext.forDstu1(); FhirContext ctx = FhirContext.forDstu1();
// Alternately, create a context for DSTU2
FhirContext ctxDstu2 = FhirContext.forDstu2();
// END SNIPPET: creatingContext // END SNIPPET: creatingContext
} }
@SuppressWarnings("unused")
public static void creatingContextHl7org() {
// START SNIPPET: creatingContextHl7org
// To use the RI structures, you need to specifically use a FhirContext configured
// for HL7.org Structures
FhirContext ctx = FhirContext.forDstu2Hl7Org();
// Working with RI structures is similar to how it works with the HAPI structures
org.hl7.fhir.instance.model.Patient patient = new org.hl7.fhir.instance.model.Patient();
patient.addName().addGiven("John").addFamily("Smith");
patient.getBirthDateElement().setValueAsString("1998-02-22");
// Parsing and encoding works the same way too
String encoded = ctx.newJsonParser().encodeResourceToString(patient);
// END SNIPPET: creatingContextHl7org
}
public static void main(String[] args) throws DataFormatException { public static void main(String[] args) throws DataFormatException {

View File

@ -24,10 +24,12 @@ import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.TagList;
/** /**
@ -124,7 +126,8 @@ public interface IParser {
* *
* @param theReader * @param theReader
* The reader to parse input from. Note that the Reader will not be closed by the parser upon completion. * The reader to parse input from. Note that the Reader will not be closed by the parser upon completion.
* @return A parsed resource * @return A parsed resource. Note that the returned object will be an instance of {@link IResource} or {@link IAnyResource}
* depending on the specific FhirContext which created this parser.
* @throws DataFormatException * @throws DataFormatException
* If the resource can not be parsed because the data is not recognized or invalid for any reason * If the resource can not be parsed because the data is not recognized or invalid for any reason
*/ */
@ -135,7 +138,8 @@ public interface IParser {
* *
* @param theMessageString * @param theMessageString
* The string to parse * The string to parse
* @return A parsed resource * @return A parsed resource. Note that the returned object will be an instance of {@link IResource} or {@link IAnyResource}
* depending on the specific FhirContext which created this parser.
* @throws DataFormatException * @throws DataFormatException
* If the resource can not be parsed because the data is not recognized or invalid for any reason * If the resource can not be parsed because the data is not recognized or invalid for any reason
*/ */

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.api; package ca.uhn.fhir.rest.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
/** /**

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.method; package ca.uhn.fhir.rest.method;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -161,7 +161,7 @@
is shown, so that we can deploy the site even if the project is on a is shown, so that we can deploy the site even if the project is on a
snapshot version. snapshot version.
--> -->
<hapi_stable_version>0.9</hapi_stable_version> <hapi_stable_version>1.0</hapi_stable_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -17,7 +17,7 @@
</p> </p>
<p> <p>
HAPI was originally started as a separate Java implementation of FHIR, HAPI was originally started as a separate Java implementation of FHIR,
but with a fairly different focus: implementing servers with an easily with a fairly different focus: implementing servers with an easily
extendible data model. Over time though, the two Java implementations have extendible data model. Over time though, the two Java implementations have
shown a fair bit of overlap, so at the 2014 shown a fair bit of overlap, so at the 2014
<a href="http://fhir.furore.com/Events/DevDaysEval2014">DevDays</a> we decided <a href="http://fhir.furore.com/Events/DevDaysEval2014">DevDays</a> we decided
@ -39,7 +39,7 @@
of HAPI's code-first statically bound extension mechanism. of HAPI's code-first statically bound extension mechanism.
</p> </p>
<subsection name="How it Works"> <subsection name="The RI Data Model">
<p> <p>
At this point, the RI integration consists of a new parallel set of At this point, the RI integration consists of a new parallel set of
classes representing the FHIR data model. For example, in addition to the classes representing the FHIR data model. For example, in addition to the
@ -69,8 +69,45 @@
<img src="./images/hapi-1.1-structs-datatypes.png" alt="Structures"/> <img src="./images/hapi-1.1-structs-datatypes.png" alt="Structures"/>
</subsection> </subsection>
<subsection name="Using the RI Structures in Your Application">
<p>
If you want to use the RI structures in your application,
you will need to use the "hapi-fhir-structures-hl7org-dstu2-[version].jar"
library.
</p>
<p>
Using these structures is then similar to using other structures.
</p>
<macro name="snippet">
<param name="id" value="creatingContextHl7org" />
<param name="file" value="examples/src/main/java/example/FhirContextIntro.java" />
</macro>
</subsection>
</section> </section>
<section name="Upgrading Existing Applications to HAPI FHIR 1.1">
<p>
If you have an existing application built using a version of previous
version of HAPI FHIR, there is one change that may affect you. As shown above,
a new interface called <code>IBaseResource</code> has been introduced, and the
<code>IResource</code> interface extends from it. Many methods in the API which
previously returned <code>IResource</code> now return <code>IBaseResource</code>.
</p>
<p>
For these methods, you may cast the <code>IBaseResource</code> to
<code>IResource</code>.
</p>
</section>
<!-- <!--
<section name="Upgrading to HAPI FHIR 0.8"> <section name="Upgrading to HAPI FHIR 0.8">