hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

The hapi-fhir-jpaserver-example project's JpaServerDemo supports DSTU1 and DSTU2, but not DSTU2.1 #278

Closed karlmdavis closed 8 years ago

karlmdavis commented 8 years ago

This class has a number of if ... else blocks that cope with the differences between DSTU1 and DSTU2, but does not yet include any logic for DSTU2.1.

Not a big deal, but would be nice.

karlmdavis commented 8 years ago

I've created Pull Request #279 to address the JpaServerDemo changes needed. In addition, the following patch can be applied manually to address the other files that need to be updated to switch things to DSTU2.1:

diff --git a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java
index 9186ebd..4f6e6b1 100644
--- a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java
+++ b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java
@@ -15,16 +15,16 @@
 import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
 import org.springframework.transaction.annotation.EnableTransactionManagement;

-import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu2;
+import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu21;
 import ca.uhn.fhir.jpa.dao.DaoConfig;
-import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorDstu2;
+import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorDstu21;
 import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
 import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
 import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;

 @Configuration
 @EnableTransactionManagement()
-public class FhirServerConfig extends BaseJavaConfigDstu2 {
+public class FhirServerConfig extends BaseJavaConfigDstu21 {

    /**
     * Configure FHIR properties around the the JPA server via this bean
@@ -108,7 +108,7 @@

    @Bean(autowire = Autowire.BY_TYPE)
    public IServerInterceptor subscriptionSecurityInterceptor() {
-       SubscriptionsRequireManualActivationInterceptorDstu2 retVal = new SubscriptionsRequireManualActivationInterceptorDstu2();
+       SubscriptionsRequireManualActivationInterceptorDstu21 retVal = new SubscriptionsRequireManualActivationInterceptorDstu21();
        return retVal;
    }

diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
index c81a6f6..ad7ebb5 100644
--- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
+++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
@@ -42,7 +42,7 @@
        </init-param>
        <init-param>
            <param-name>FhirVersion</param-name>
-           <param-value>DSTU2</param-value>
+           <param-value>DSTU2_1</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
diff --git a/hapi-fhir-jpaserver-example/src/test/java/ca/uhn/fhir/jpa/demo/ExampleServerIT.java b/hapi-fhir-jpaserver-example/src/test/java/ca/uhn/fhir/jpa/demo/ExampleServerIT.java
index f4efde6..13463e4 100644
--- a/hapi-fhir-jpaserver-example/src/test/java/ca/uhn/fhir/jpa/demo/ExampleServerIT.java
+++ b/hapi-fhir-jpaserver-example/src/test/java/ca/uhn/fhir/jpa/demo/ExampleServerIT.java
@@ -7,13 +7,13 @@

 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.webapp.WebAppContext;
+import org.hl7.fhir.dstu21.model.Patient;
 import org.hl7.fhir.instance.model.api.IIdType;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;

 import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.dstu2.resource.Patient;
 import ca.uhn.fhir.rest.client.IGenericClient;
 import ca.uhn.fhir.rest.client.ServerValidationModeEnum;
 import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;