From 0cc53ca742654471c73e36182d59bbfefcac77b2 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Fri, 12 Jun 2015 17:50:01 -0400
Subject: [PATCH] Documentation updates
---
examples/pom.xml | 5 +++
.../main/java/example/FhirContextIntro.java | 22 ++++++++++
.../main/java/ca/uhn/fhir/parser/IParser.java | 10 +++--
.../uhn/fhir/rest/api/ValidationModeEnum.java | 20 +++++++++
.../method/ValidateMethodBindingDstu2.java | 20 +++++++++
pom.xml | 2 +-
src/site/xdoc/doc_upgrading.xml | 43 +++++++++++++++++--
7 files changed, 115 insertions(+), 7 deletions(-)
diff --git a/examples/pom.xml b/examples/pom.xml
index d123de893bb..4316da83aab 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -24,6 +24,11 @@
hapi-fhir-structures-dstu2
1.1-SNAPSHOT
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-hl7org-dstu2
+ 1.1-SNAPSHOT
+
javax.servlet
javax.servlet-api
diff --git a/examples/src/main/java/example/FhirContextIntro.java b/examples/src/main/java/example/FhirContextIntro.java
index 32f21bcb50e..66966d2c2c9 100644
--- a/examples/src/main/java/example/FhirContextIntro.java
+++ b/examples/src/main/java/example/FhirContextIntro.java
@@ -14,11 +14,33 @@ public class FhirContextIntro {
@SuppressWarnings("unused")
public static void creatingContext() {
// START SNIPPET: creatingContext
+// Create a context for DSTU1
FhirContext ctx = FhirContext.forDstu1();
+
+// Alternately, create a context for DSTU2
+FhirContext ctxDstu2 = FhirContext.forDstu2();
// 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 {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
index 1ff913a68dd..37d80dced8f 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
@@ -24,10 +24,12 @@ import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
+import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.Bundle;
+import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList;
/**
@@ -120,11 +122,12 @@ public interface IParser {
T parseResource(Class theResourceType, String theString) throws DataFormatException;
/**
- * Parses a resource
+ * Parses a resource
*
* @param theReader
* 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
* 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
* 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
* If the resource can not be parsed because the data is not recognized or invalid for any reason
*/
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/ValidationModeEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/ValidationModeEnum.java
index 8f072c4829d..4ec0cd9721b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/ValidationModeEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/ValidationModeEnum.java
@@ -1,5 +1,25 @@
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;
/**
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBindingDstu2.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBindingDstu2.java
index 87a77eaf75e..bdf8b477280 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBindingDstu2.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ValidateMethodBindingDstu2.java
@@ -1,5 +1,25 @@
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.util.ArrayList;
import java.util.List;
diff --git a/pom.xml b/pom.xml
index e483a8ff3aa..4272bb7e6a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -161,7 +161,7 @@
is shown, so that we can deploy the site even if the project is on a
snapshot version.
-->
- 0.9
+ 1.0
UTF-8
diff --git a/src/site/xdoc/doc_upgrading.xml b/src/site/xdoc/doc_upgrading.xml
index c7752150b18..10f894f5420 100644
--- a/src/site/xdoc/doc_upgrading.xml
+++ b/src/site/xdoc/doc_upgrading.xml
@@ -17,13 +17,13 @@
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
shown a fair bit of overlap, so at the 2014
DevDays we decided
to try and harmonize the two libraries.
-
+
HAPI FHIR 1.1 begins the availability of a harmonized library. Note that
this version has not yet been formally released, but is currently available in
"snapshot" development builds.
@@ -39,7 +39,7 @@
of HAPI's code-first statically bound extension mechanism.
-
+
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
@@ -69,8 +69,45 @@
+
+
+
+
+ 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.
+
+
+
+ Using these structures is then similar to using other structures.
+
+
+
+
+
+
+
+
+
+
+
+
+ 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 IBaseResource
has been introduced, and the
+ IResource
interface extends from it. Many methods in the API which
+ previously returned IResource
now return IBaseResource
.
+
+
+ For these methods, you may cast the IBaseResource
to
+ IResource
.
+
+
+
+
+