Merge branch 'master' of github.com:jamesagnew/hapi-fhir

This commit is contained in:
James Agnew 2015-02-26 17:28:05 -05:00
commit 0a8c7c4960
6 changed files with 80 additions and 9 deletions

View File

@ -27,7 +27,7 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.7"/> <installed facet="java" version="1.6"/>
</faceted-project> </faceted-project>

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import ca.uhn.fhir.context.FhirVersionEnum;
import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
@ -31,9 +32,12 @@ public class JpaServerDemo extends RestfulServer {
/* /*
* We want to support FHIR DSTU2 format. This means that the server * We want to support FHIR DSTU2 format. This means that the server
* will use the DSTU2 bundle format and other DSTU2 encoding changes. * will use the DSTU2 bundle format and other DSTU2 encoding changes.
*
* If you want to use DSTU1 instead, change the following line, and change the 2 occurrences of dstu2 in web.xml to dstu1
*/ */
setFhirContext(FhirContext.forDstu2()); FhirVersionEnum fhirVersion = FhirVersionEnum.DSTU2;
setFhirContext(new FhirContext(fhirVersion));
// Get the spring context from the web container (it's declared in web.xml) // Get the spring context from the web container (it's declared in web.xml)
myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext(); myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext();
@ -42,14 +46,20 @@ public class JpaServerDemo extends RestfulServer {
* file which is automatically generated as a part of hapi-fhir-jpaserver-base and * file which is automatically generated as a part of hapi-fhir-jpaserver-base and
* contains bean definitions for a resource provider for each resource type * contains bean definitions for a resource provider for each resource type
*/ */
List<IResourceProvider> beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class); String resourceProviderBeanName = "myResourceProvidersDstu" + (fhirVersion == FhirVersionEnum.DSTU1 ? "1" : "2");
List<IResourceProvider> beans = myAppCtx.getBean(resourceProviderBeanName, List.class);
setResourceProviders(beans); setResourceProviders(beans);
/* /*
* The system provider implements non-resource-type methods, such as * The system provider implements non-resource-type methods, such as
* transaction, and global history. * transaction, and global history.
*/ */
JpaSystemProviderDstu2 systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class); Object systemProvider;
if (fhirVersion == FhirVersionEnum.DSTU1) {
systemProvider = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class);
} else {
systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
}
setPlainProviders(systemProvider); setPlainProviders(systemProvider);
/* /*

View File

@ -87,7 +87,7 @@ public class MyOrganization extends Organization {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return ElementUtil.isEmpty(super.isEmpty(), myBillingCode, myEmergencyContact); return super.isEmpty() && ElementUtil.isEmpty(myBillingCode, myEmergencyContact);
} }
/** /**

View File

@ -76,17 +76,19 @@
<item name="Introduction" href="./doc_intro.html"> <item name="Introduction" href="./doc_intro.html">
<item name="DSTU2 Support (new)" href="./doc_dstu2.html" /> <item name="DSTU2 Support (new)" href="./doc_dstu2.html" />
</item> </item>
<item name="The Data Model" href="./doc_fhirobjects.html"> <item name="The Data Model" href="./doc_fhirobjects.html">
<item name="Profiles &amp; Extensions" href="./doc_extensions.html" /> <item name="Working with Resources" href="./doc_fhirobjects.html" />
<item name="Resource References" href="./doc_resource_references.html" /> <item name="Resource References" href="./doc_resource_references.html" />
<item name="Profiles &amp; Extensions" href="./doc_extensions.html" />
<item name="Tags" href="./doc_tags.html" /> <item name="Tags" href="./doc_tags.html" />
<item name="Validation" href="./doc_validation.html" /> <item name="Validation" href="./doc_validation.html" />
</item> </item>
<item name="RESTful Client" href="./doc_rest_client.html" > <item name="RESTful Client" href="./doc_rest_client.html" >
<item name="Using RESTful Client" href="./doc_rest_client.html" />
<item name="Interceptors (client)" href="./doc_rest_client_interceptor.html"/> <item name="Interceptors (client)" href="./doc_rest_client_interceptor.html"/>
</item> </item>
<item name="RESTful Server" href="./doc_rest_server.html" > <item name="RESTful Server" href="./doc_rest_server.html" >
<item name="Using RESTful Server" href="./doc_rest_server.html" />
<item name="RESTful Operations" href="./doc_rest_operations.html" /> <item name="RESTful Operations" href="./doc_rest_operations.html" />
<item name="Narrative Generator" href="./doc_narrative.html" /> <item name="Narrative Generator" href="./doc_narrative.html" />
<item name="CORS Support" href="./doc_cors.html" /> <item name="CORS Support" href="./doc_cors.html" />

View File

@ -0,0 +1,59 @@
<?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">
<properties>
<title>Documentation - HAPI FHIR</title>
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
</properties>
<body>
<section name="Documentation">
<p>
Welcome to HAPI FHIR! We hope that the documentation here will be
helpful to you.
</p>
<ul>
<li><a href="./doc_intro.html">Introduction</a></li>
<li><a href="./doc_dstu2.html">DSTU2 Support (new)</a></li>
</ul>
<h4>The Data Model</h4>
<ul>
<li><a href="./doc_fhirobjects.html">Working with Resources</a></li>
<li><a href="./doc_extensions.html">Profiles &amp; Extensions</a></li>
<li><a href="./doc_resource_references.html">Resource References</a></li>
<li><a href="./doc_tags.html">Tags</a></li>
<li><a href="./doc_validation.html">Validation</a></li>
</ul>
<h4>RESTful Client</h4>
<ul>
<li><a href="./doc_rest_client.html">Using RESTful Client</a></li>
<li><a href="./doc_rest_client_interceptor.html">Interceptors (client)</a></li>
</ul>
<h4>RESTful Server</h4>
<ul>
<li><a href="./doc_rest_server.html">Using RESTful Server</a></li>
<li><a href="./doc_rest_operations.html">RESTful Operations</a></li>
<li><a href="./doc_narrative.html">Narrative Generator</a></li>
<li><a href="./doc_cors.html">CORS Support</a></li>
<li><a href="./doc_rest_server_interceptor.html">Interceptors (server)</a></li>
<li><a href="./doc_server_tester.html">Web Testing UI</a></li>
</ul>
<!--
<li name="Logging" href="./doc_logging.html" />
<li name="ETags" href="./doc_rest_etag.html" />
<li name="Tinder Plugin" href="./doc_tinder.html" />
<li name="JPA/Database Server" href="./doc_jpa.html" />
</ul>
-->
</section>
</body>
</document>