diff --git a/hapi-fhir-base-example-embedded-ws/.classpath b/example-projects/hapi-fhir-base-example-embedded-ws/.classpath similarity index 100% rename from hapi-fhir-base-example-embedded-ws/.classpath rename to example-projects/hapi-fhir-base-example-embedded-ws/.classpath diff --git a/hapi-fhir-base-example-embedded-ws/.project b/example-projects/hapi-fhir-base-example-embedded-ws/.project similarity index 100% rename from hapi-fhir-base-example-embedded-ws/.project rename to example-projects/hapi-fhir-base-example-embedded-ws/.project diff --git a/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.core.resources.prefs b/example-projects/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.core.resources.prefs rename to example-projects/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.core.resources.prefs diff --git a/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.m2e.core.prefs b/example-projects/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.m2e.core.prefs rename to example-projects/hapi-fhir-base-example-embedded-ws/.settings/org.eclipse.m2e.core.prefs diff --git a/hapi-fhir-base-example-embedded-ws/pom.xml b/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml similarity index 95% rename from hapi-fhir-base-example-embedded-ws/pom.xml rename to example-projects/hapi-fhir-base-example-embedded-ws/pom.xml index c37d000f727..ce746e8ae97 100644 --- a/hapi-fhir-base-example-embedded-ws/pom.xml +++ b/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml @@ -5,6 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir 2.3-SNAPSHOT + ../hapi-deployable-pom/pom.xml jar @@ -41,6 +42,7 @@ org.ebaysf.web cors-filter + 1.0.1 ca.uhn.hapi.fhir @@ -71,4 +73,4 @@ - \ No newline at end of file + diff --git a/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ContextListener.java b/example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ContextListener.java similarity index 100% rename from hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ContextListener.java rename to example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ContextListener.java diff --git a/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/FhirRestfulServlet.java b/example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/FhirRestfulServlet.java similarity index 100% rename from hapi-fhir-base-example-embedded-ws/src/main/java/embedded/FhirRestfulServlet.java rename to example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/FhirRestfulServlet.java diff --git a/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ServerStartup.java b/example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ServerStartup.java similarity index 100% rename from hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ServerStartup.java rename to example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/ServerStartup.java diff --git a/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/SomeResourceProvider.java b/example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/SomeResourceProvider.java similarity index 100% rename from hapi-fhir-base-example-embedded-ws/src/main/java/embedded/SomeResourceProvider.java rename to example-projects/hapi-fhir-base-example-embedded-ws/src/main/java/embedded/SomeResourceProvider.java diff --git a/example-projects/hapi-fhir-standalone-overlay-example/pom.xml b/example-projects/hapi-fhir-standalone-overlay-example/pom.xml index 05efe37315f..fef33f1705c 100644 --- a/example-projects/hapi-fhir-standalone-overlay-example/pom.xml +++ b/example-projects/hapi-fhir-standalone-overlay-example/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-fhir - 2.1-SNAPSHOT + 2.3-SNAPSHOT + ../hapi-deployable-pom/pom.xml hapi-fhir-standalone-overlay-example @@ -36,14 +37,14 @@ ca.uhn.hapi.fhir hapi-fhir-testpage-overlay - 2.1-SNAPSHOT + 2.3-SNAPSHOT war provided ca.uhn.hapi.fhir hapi-fhir-testpage-overlay - 2.1-SNAPSHOT + 2.3-SNAPSHOT classes provided @@ -73,6 +74,7 @@ org.ebaysf.web cors-filter + 1.0.1 diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java index 5cb84b72763..3000ed48133 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java @@ -28,10 +28,7 @@ import java.io.Reader; import java.nio.charset.Charset; import java.util.Collections; import java.util.Enumeration; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.Set; import java.util.zip.GZIPInputStream; import javax.servlet.http.HttpServletRequest; @@ -41,7 +38,6 @@ import org.apache.commons.io.IOUtils; import org.apache.http.entity.ContentType; import ca.uhn.fhir.context.ConfigurationException; -import ca.uhn.fhir.rest.api.RequestTypeEnum; import ca.uhn.fhir.rest.method.BaseMethodBinding; import ca.uhn.fhir.rest.method.BaseMethodBinding.IRequestReader; import ca.uhn.fhir.rest.method.RequestDetails; @@ -168,17 +164,6 @@ public class ServletRequestDetails extends RequestDetails { this.myServletResponse = myServletResponse; } - public static RequestDetails withResourceAndParams(String theResourceName, RequestTypeEnum theRequestType, Set theParamNames) { - RequestDetails retVal = new ServletRequestDetails(); - retVal.setResourceName(theResourceName); - retVal.setRequestType(theRequestType); - Map paramNames = new HashMap(); - for (String next : theParamNames) { - paramNames.put(next, new String[0]); - } - retVal.setParameters(paramNames); - return retVal; - } @Override public Charset getCharset() { diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 3f5f9a01fc6..fdd93780866 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -419,6 +419,7 @@ alphabetical ${argLine} -Dfile.encoding=UTF-8 -Xmx1024m + 0.6C diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java index 87906b7fc11..de081483877 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java @@ -2,12 +2,17 @@ package ca.uhn.fhir.rest.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import javax.servlet.http.HttpServletRequest; + import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; @@ -54,7 +59,7 @@ public class ResourceMethodTest { inputParams.add("lastName"); inputParams.add("mrn"); - RequestDetails params = ServletRequestDetails.withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams); + RequestDetails params = withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams); boolean actual = rm.incomingServerRequestMatchesMethod(params); assertTrue( actual); // True } @@ -75,7 +80,7 @@ public class ResourceMethodTest { inputParams.add("mrn"); inputParams.add("foo"); - assertEquals(false, rm.incomingServerRequestMatchesMethod(ServletRequestDetails.withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // False + assertEquals(false, rm.incomingServerRequestMatchesMethod(withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // False } @Test @@ -92,7 +97,7 @@ public class ResourceMethodTest { inputParams.add("firstName"); inputParams.add("mrn"); - assertEquals(true, rm.incomingServerRequestMatchesMethod(ServletRequestDetails.withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // True + assertEquals(true, rm.incomingServerRequestMatchesMethod(withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // True } @Test @@ -109,7 +114,7 @@ public class ResourceMethodTest { inputParams.add("firstName"); inputParams.add("lastName"); - assertEquals(false, rm.incomingServerRequestMatchesMethod(ServletRequestDetails.withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // False + assertEquals(false, rm.incomingServerRequestMatchesMethod(withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // False } @Test @@ -124,7 +129,7 @@ public class ResourceMethodTest { Set inputParams = new HashSet(); inputParams.add("mrn"); - assertEquals(true, rm.incomingServerRequestMatchesMethod(ServletRequestDetails.withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // True + assertEquals(true, rm.incomingServerRequestMatchesMethod(withResourceAndParams("Patient", RequestTypeEnum.GET, inputParams))); // True } @Test(expected=IllegalStateException.class) @@ -142,4 +147,18 @@ public class ResourceMethodTest { TestUtil.clearAllStaticFieldsForUnitTest(); } + + public static RequestDetails withResourceAndParams(String theResourceName, RequestTypeEnum theRequestType, Set theParamNames) { + ServletRequestDetails retVal = new ServletRequestDetails(); + retVal.setResourceName(theResourceName); + retVal.setRequestType(theRequestType); + Map paramNames = new HashMap(); + for (String next : theParamNames) { + paramNames.put(next, new String[0]); + } + retVal.setParameters(paramNames); + retVal.setServletRequest(mock(HttpServletRequest.class)); + return retVal; + } + } diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm index 7230adc3648..d3c5c30e8c8 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm @@ -21,9 +21,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.rest.server.IResourceProvider; -import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.dao.IFhirSystemDao; +import ca.uhn.fhir.jpa.dao.*; @Configuration public abstract class BaseJavaConfig${versionCapitalized} extends ca.uhn.fhir.jpa.config${package_suffix}.Base${versionCapitalized}Config { @@ -49,12 +47,23 @@ public abstract class BaseJavaConfig${versionCapitalized} extends ca.uhn.fhir.jp #foreach ( $res in $resources ) @Bean(name="my${res.name}Dao${versionCapitalized}", autowire=Autowire.BY_NAME) @Lazy - public IFhirResourceDao<${resourcePackage}.${res.declaringClassNameComplete}> dao${res.declaringClassNameComplete}${versionCapitalized}() { - ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}> retVal; -#if ( ${versionCapitalized} != 'Dstu1' && ( ${res.name} == 'Bundle' || ${res.name} == 'Encounter' || ${res.name} == 'Everything' || ${res.name} == 'Patient' || ${res.name} == 'Subscription' || ${res.name} == 'ValueSet' || ${res.name} == 'QuestionnaireResponse' || ${res.name} == 'SearchParameter' || ${res.name} == 'CodeSystem')) - retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); + public +#if ( ${versionCapitalized} == 'Dstu2' && ${res.name} == 'ValueSet' ) + IFhirResourceDaoValueSet +#elseif ( ${versionCapitalized} == 'Dstu3' && ${res.name} == 'ValueSet' ) + IFhirResourceDaoValueSet +#elseif ( ${versionCapitalized} == 'Dstu3' && ${res.name} == 'CodeSystem' ) + IFhirResourceDaoCodeSystem +#elseif ( ${versionCapitalized} != 'Dstu1' && ( ${res.name} == 'Encounter' || ${res.name} == 'Everything' || ${res.name} == 'Patient' || ${res.name} == 'Subscription' || ${res.name} == 'SearchParameter')) + IFhirResourceDao${res.name}<${resourcePackage}.${res.declaringClassNameComplete}> #else - retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}>(); + IFhirResourceDao<${resourcePackage}.${res.declaringClassNameComplete}> +#end + dao${res.declaringClassNameComplete}${versionCapitalized}() { +#if ( ${versionCapitalized} != 'Dstu1' && ( ${res.name} == 'Bundle' || ${res.name} == 'Encounter' || ${res.name} == 'Everything' || ${res.name} == 'Patient' || ${res.name} == 'Subscription' || ${res.name} == 'ValueSet' || ${res.name} == 'QuestionnaireResponse' || ${res.name} == 'SearchParameter' || ${res.name} == 'CodeSystem')) + ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); +#else + ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}> retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}>(); #end retVal.setResourceType(${resourcePackage}.${res.declaringClassNameComplete}.class); retVal.setContext(fhirContext${versionCapitalized}()); diff --git a/pom.xml b/pom.xml index 8fde86d0a16..63286b29d3e 100644 --- a/pom.xml +++ b/pom.xml @@ -325,7 +325,7 @@ 2.4 2.7.1 4.4.6 - 4.3.1.RELEASE + 4.3.4.RELEASE 3.0.1.RELEASE 1.6 @@ -1642,7 +1642,8 @@ hapi-fhir-cli hapi-fhir-dist examples - hapi-fhir-base-example-embedded-ws + example-projects/hapi-fhir-base-example-embedded-ws + example-projects/hapi-fhir-standalone-overlay-example hapi-fhir-jacoco diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a8dd6006321..2d651282ea0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -12,7 +12,7 @@ latest versions (dependent HAPI modules listed in brackets): - +
  • spring (JPA): 4.3.1 -> 4.3.4
  • Derby (CLI): 10.12.1.1 -> 10.13.1.1
  • Jetty (CLI): 9.3.10.v20160621 -> 9.3.14.v20161028
  • JAnsi (CLI): 1.13 -> 1.14