From 0f8c8d18e230d8371e9d7355924bded7b29c37ee Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 6 Feb 2019 20:02:28 -0500 Subject: [PATCH 1/2] Bump version to 3.8.0-SNAPSHOT --- example-projects/hapi-fhir-base-example-embedded-ws/pom.xml | 2 +- example-projects/hapi-fhir-jpaserver-cds-example/pom.xml | 2 +- example-projects/hapi-fhir-jpaserver-dynamic/pom.xml | 2 +- example-projects/hapi-fhir-jpaserver-example-postgres/pom.xml | 2 +- example-projects/hapi-fhir-standalone-overlay-example/pom.xml | 2 +- examples/pom.xml | 2 +- hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-igpacks/pom.xml | 2 +- hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- hapi-fhir-jaxrsserver-example/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-elasticsearch/pom.xml | 2 +- hapi-fhir-jpaserver-example/pom.xml | 2 +- hapi-fhir-jpaserver-migrate/pom.xml | 2 +- hapi-fhir-jpaserver-model/pom.xml | 2 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 4 ++-- hapi-fhir-server/pom.xml | 2 +- .../hapi-fhir-spring-boot-autoconfigure/pom.xml | 2 +- .../hapi-fhir-spring-boot-sample-client-apache/pom.xml | 2 +- .../hapi-fhir-spring-boot-sample-client-okhttp/pom.xml | 2 +- .../hapi-fhir-spring-boot-sample-server-jersey/pom.xml | 2 +- .../hapi-fhir-spring-boot-sample-server-jpa/pom.xml | 2 +- hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml | 2 +- hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-testpage-overlay/pom.xml | 2 +- hapi-fhir-utilities/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2.1/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 4 ++-- hapi-tinder-test/pom.xml | 2 +- osgi/hapi-fhir-karaf-features/pom.xml | 2 +- osgi/hapi-fhir-karaf-integration-tests/pom.xml | 2 +- pom.xml | 4 +--- restful-server-example-test/pom.xml | 2 +- restful-server-example/pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-client/pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-server/pom.xml | 2 +- 59 files changed, 61 insertions(+), 63 deletions(-) diff --git a/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml b/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml index ec907913df1..80e1330ca7d 100644 --- a/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml +++ b/example-projects/hapi-fhir-base-example-embedded-ws/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml diff --git a/example-projects/hapi-fhir-jpaserver-cds-example/pom.xml b/example-projects/hapi-fhir-jpaserver-cds-example/pom.xml index 747969ff8fb..a8f9343d377 100644 --- a/example-projects/hapi-fhir-jpaserver-cds-example/pom.xml +++ b/example-projects/hapi-fhir-jpaserver-cds-example/pom.xml @@ -10,7 +10,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml diff --git a/example-projects/hapi-fhir-jpaserver-dynamic/pom.xml b/example-projects/hapi-fhir-jpaserver-dynamic/pom.xml index fdadc1732e8..1d1616d3f5a 100644 --- a/example-projects/hapi-fhir-jpaserver-dynamic/pom.xml +++ b/example-projects/hapi-fhir-jpaserver-dynamic/pom.xml @@ -10,7 +10,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml diff --git a/example-projects/hapi-fhir-jpaserver-example-postgres/pom.xml b/example-projects/hapi-fhir-jpaserver-example-postgres/pom.xml index 342a460b37e..75cf9c63ac4 100644 --- a/example-projects/hapi-fhir-jpaserver-example-postgres/pom.xml +++ b/example-projects/hapi-fhir-jpaserver-example-postgres/pom.xml @@ -10,7 +10,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml diff --git a/example-projects/hapi-fhir-standalone-overlay-example/pom.xml b/example-projects/hapi-fhir-standalone-overlay-example/pom.xml index 55987abe2d9..86de1147a06 100644 --- a/example-projects/hapi-fhir-standalone-overlay-example/pom.xml +++ b/example-projects/hapi-fhir-standalone-overlay-example/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml hapi-fhir-standalone-overlay-example diff --git a/examples/pom.xml b/examples/pom.xml index 54495f97821..67954539d09 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 2de01a01948..ed19d054d30 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 0e3d907e1aa..751b20037f9 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 52b1bec6ada..42fdfa2f678 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index 6428e7eb9b7..f90dea9dd1f 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index abcfc9ddac0..c228b3c0bff 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index dcd4271f02a..56c5cf80105 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 9624aa6997a..36a508737b7 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index bfb7c838e0f..97c36c42338 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index c32fc7e0336..52bb34401af 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index bba64a54785..bcce41b8e78 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 73ed88407da..b9695b0d936 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-igpacks/pom.xml b/hapi-fhir-igpacks/pom.xml index e0bfaf74518..3969dcef1fc 100644 --- a/hapi-fhir-igpacks/pom.xml +++ b/hapi-fhir-igpacks/pom.xml @@ -5,7 +5,7 @@ hapi-deployable-pom ca.uhn.hapi.fhir - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 95583e4c200..d3ede7ebf75 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index 5338aaadbbf..9dc1ad08f9a 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-example/pom.xml b/hapi-fhir-jaxrsserver-example/pom.xml index 5c9a381c6d1..df96b7d78d1 100644 --- a/hapi-fhir-jaxrsserver-example/pom.xml +++ b/hapi-fhir-jaxrsserver-example/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 0f72ad9260b..7cb3f25e1e7 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-elasticsearch/pom.xml b/hapi-fhir-jpaserver-elasticsearch/pom.xml index dcb26bc68a7..f6bd92fd420 100644 --- a/hapi-fhir-jpaserver-elasticsearch/pom.xml +++ b/hapi-fhir-jpaserver-elasticsearch/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-example/pom.xml b/hapi-fhir-jpaserver-example/pom.xml index 63ec5db19c8..1f3a256f2c3 100644 --- a/hapi-fhir-jpaserver-example/pom.xml +++ b/hapi-fhir-jpaserver-example/pom.xml @@ -10,7 +10,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-jpaserver-migrate/pom.xml b/hapi-fhir-jpaserver-migrate/pom.xml index e61a5ccfe2f..3eff9239bdb 100644 --- a/hapi-fhir-jpaserver-migrate/pom.xml +++ b/hapi-fhir-jpaserver-migrate/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index d99260c1ede..2a916a21b21 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index fc827b4afaa..44b1de27809 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index b0073523ab2..4d4527b9bca 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 93fa22ba2de..8c150f1d277 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml @@ -158,7 +158,7 @@ ca.uhn.hapi.fhir hapi-fhir-converter - 3.7.0 + 3.8.0-SNAPSHOT diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index af7a5f2c084..a2a0b4979da 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index d2009d5c948..8acd561acf7 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index c3eb1788c3d..6a846653b26 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 3.7.0 + 3.8.0-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index fee265da574..496791d1614 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 3.7.0 + 3.8.0-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 39c1ed829eb..acd85bf7c88 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 3.7.0 + 3.8.0-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/pom.xml index 3a12a95c5ce..300fb3396a0 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 3.7.0 + 3.8.0-SNAPSHOT hapi-fhir-spring-boot-sample-server-jpa diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index d062f0f5135..ead295da2a9 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 3.7.0 + 3.8.0-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index f0ef11efeb3..6331e4cdea1 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index 3c78a06f8d3..0aa66adc31e 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index c4929873635..6f3e83c9662 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 2bd72e19d4e..04ee203172e 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index d97a85a92b7..7af42d55e85 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index ce21dff61fa..f805f6873a3 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index eb50599cf77..30d4645aaef 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index 8dab900e19b..d88a4d70400 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-utilities/pom.xml b/hapi-fhir-utilities/pom.xml index fe1a910ba1d..f470df640b7 100644 --- a/hapi-fhir-utilities/pom.xml +++ b/hapi-fhir-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 6e500b6358d..165bc28a52d 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 2f429b94d9f..03e137107b2 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index 52c23a851ea..dd8f42b5795 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 0dad10a0b59..0f104834310 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index bcb465bd460..21fde226998 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 3042581021d..8dd75e519fb 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml @@ -73,7 +73,7 @@ ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 3.7.0 + 3.8.0-SNAPSHOT ca.uhn.hapi.fhir diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 85b4475d56f..078b00b27a2 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/osgi/hapi-fhir-karaf-features/pom.xml b/osgi/hapi-fhir-karaf-features/pom.xml index 620793a3ac2..67e74d50c43 100644 --- a/osgi/hapi-fhir-karaf-features/pom.xml +++ b/osgi/hapi-fhir-karaf-features/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/osgi/hapi-fhir-karaf-integration-tests/pom.xml b/osgi/hapi-fhir-karaf-integration-tests/pom.xml index 1b4ae907ea5..bc64dc57db8 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/pom.xml +++ b/osgi/hapi-fhir-karaf-integration-tests/pom.xml @@ -20,7 +20,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 3.7.0 + 3.8.0-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/pom.xml b/pom.xml index fc452c22908..a0ab12ac3a5 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 3.7.0 + 3.8.0-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io @@ -1567,8 +1567,6 @@ org.apache.maven.plugins maven-site-plugin - 3.7.1 false diff --git a/restful-server-example-test/pom.xml b/restful-server-example-test/pom.xml index 181ab6c01b1..4ce3d078bde 100644 --- a/restful-server-example-test/pom.xml +++ b/restful-server-example-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/restful-server-example/pom.xml b/restful-server-example/pom.xml index 642faa7c4eb..07ec615bed5 100644 --- a/restful-server-example/pom.xml +++ b/restful-server-example/pom.xml @@ -8,7 +8,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index e288ebc7a6d..7d3d14f8d3e 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index 925ad565ebe..7eaf41ff4f5 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ../../pom.xml From 810f1ad969b377eb50bf30f40bde1ac14e76f4ee Mon Sep 17 00:00:00 2001 From: James Agnew Date: Thu, 7 Feb 2019 16:45:59 -0500 Subject: [PATCH 2/2] Improvements to elements parameter as well as adding attributes to RequestDetails --- .../java/ca/uhn/fhir/parser/BaseParser.java | 124 ++++-- .../java/ca/uhn/fhir/parser/JsonParser.java | 26 +- .../java/ca/uhn/fhir/parser/XmlParser.java | 47 ++- .../fhir/jaxrs/server/util/JaxRsRequest.java | 396 ++++++++++-------- .../provider/r4/ResourceProviderR4Test.java | 16 + .../fhir/rest/api/server/RequestDetails.java | 14 + .../uhn/fhir/rest/server/RestfulServer.java | 72 ++-- .../server/servlet/ServletRequestDetails.java | 13 + .../fhir/rest/server/ElementsParamR4Test.java | 125 +++++- src/changes/changes.xml | 14 +- 10 files changed, 545 insertions(+), 302 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java index 7d62296e836..4139c11e86e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.parser; * 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. @@ -63,7 +63,6 @@ public abstract class BaseParser implements IParser { private boolean mySummaryMode; private boolean mySuppressNarratives; private Set myDontStripVersionsFromReferencesAtPaths; - /** * Constructor */ @@ -72,6 +71,55 @@ public abstract class BaseParser implements IParser { myErrorHandler = theParserErrorHandler; } + List getDontEncodeElements() { + return myDontEncodeElements; + } + + @Override + public void setDontEncodeElements(Set theDontEncodeElements) { + if (theDontEncodeElements == null || theDontEncodeElements.isEmpty()) { + myDontEncodeElements = null; + } else { + myDontEncodeElements = theDontEncodeElements + .stream() + .map(ElementsPath::new) + .collect(Collectors.toList()); + } + } + + List getEncodeElements() { + return myEncodeElements; + } + + @Override + public void setEncodeElements(Set theEncodeElements) { + + if (theEncodeElements == null || theEncodeElements.isEmpty()) { + myEncodeElements = null; + myEncodeElementsAppliesToResourceTypes = null; + } else { + myEncodeElements = theEncodeElements + .stream() + .map(ElementsPath::new) + .collect(Collectors.toList()); + + myEncodeElementsAppliesToResourceTypes = new HashSet<>(); + for (String next : myEncodeElements.stream().map(t -> t.getPath().get(0).getName()).collect(Collectors.toList())) { + if (next.startsWith("*")) { + myEncodeElementsAppliesToResourceTypes = null; + break; + } + int dotIdx = next.indexOf('.'); + if (dotIdx == -1) { + myEncodeElementsAppliesToResourceTypes.add(next); + } else { + myEncodeElementsAppliesToResourceTypes.add(next.substring(0, dotIdx)); + } + } + + } + } + protected Iterable compositeChildIterator(IBase theCompositeElement, final boolean theContainedResource, final CompositeChildElement theParent, EncodeContext theEncodeContext) { BaseRuntimeElementCompositeDefinition elementDef = (BaseRuntimeElementCompositeDefinition) myContext.getElementDefinition(theCompositeElement.getClass()); @@ -402,35 +450,6 @@ public abstract class BaseParser implements IParser { return myDontStripVersionsFromReferencesAtPaths; } - @Override - public void setEncodeElements(Set theEncodeElements) { - - if (theEncodeElements == null || theEncodeElements.isEmpty()) { - myEncodeElements = null; - myEncodeElementsAppliesToResourceTypes = null; - } else { - myEncodeElements = theEncodeElements - .stream() - .map(ElementsPath::new) - .collect(Collectors.toList()); - - myEncodeElementsAppliesToResourceTypes = new HashSet<>(); - for (String next : myEncodeElements.stream().map(t -> t.getPath().get(0).getName()).collect(Collectors.toList())) { - if (next.startsWith("*")) { - myEncodeElementsAppliesToResourceTypes = null; - break; - } - int dotIdx = next.indexOf('.'); - if (dotIdx == -1) { - myEncodeElementsAppliesToResourceTypes.add(next); - } else { - myEncodeElementsAppliesToResourceTypes.add(next.substring(0, dotIdx)); - } - } - - } - } - @Override public IIdType getEncodeForceResourceId() { return myEncodeForceResourceId; @@ -803,18 +822,6 @@ public abstract class BaseParser implements IParser { } } - @Override - public void setDontEncodeElements(Set theDontEncodeElements) { - if (theDontEncodeElements == null || theDontEncodeElements.isEmpty()) { - myDontEncodeElements = null; - } else { - myDontEncodeElements = theDontEncodeElements - .stream() - .map(ElementsPath::new) - .collect(Collectors.toList()); - } - } - @Override public IParser setDontStripVersionsFromReferencesAtPaths(String... thePaths) { if (thePaths == null) { @@ -936,7 +943,7 @@ public abstract class BaseParser implements IParser { String resourceName = myContext.getResourceDefinition(theResource).getName(); if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath(resourceName + "." + thePath))) { return false; - } else if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath("*."+ thePath))) { + } else if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath("*." + thePath))) { return false; } } @@ -963,6 +970,17 @@ public abstract class BaseParser implements IParser { throw new DataFormatException(nextChild + " has no child of type " + theType); } + protected boolean shouldEncodeResource(String theName) { + if (myDontEncodeElements != null) { + for (ElementsPath next : myDontEncodeElements) { + if (next.equalsPath(theName)) { + return false; + } + } + } + return true; + } + class ChildNameAndDef { private final BaseRuntimeElementDefinition myChildDef; @@ -1289,9 +1307,23 @@ public abstract class BaseParser implements IParser { if (myResource != theOther.isResource()) { return false; } - if (myName.equals(theOther.getName())) { + String otherName = theOther.getName(); + if (myName.equals(otherName)) { return true; } + /* + * This is here to handle situations where a path like + * Observation.valueQuantity has been specified as an include/exclude path, + * since we only know that path as + * Observation.value + * until we get to actually looking at the values there. + */ + if (myName.length() > otherName.length() && myName.startsWith(otherName)) { + char ch = myName.charAt(otherName.length()); + if (Character.isUpperCase(ch)) { + return true; + } + } if (myName.equals("*")) { return true; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index 4c6e3ea532b..bd032d34192 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -410,8 +410,17 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { continue; } - String childName = childNameAndDef.getChildName(); - theEncodeContext.pushPath(childName, false); + /* + * Often the two values below will be the same thing. There are cases though + * where they will not be. An example would be Observation.value, which is + * a choice type. If the value contains a Quantity, then: + * nextChildGenericName = "value" + * nextChildSpecificName = "valueQuantity" + */ + String nextChildSpecificName = childNameAndDef.getChildName(); + String nextChildGenericName = nextChild.getElementName(); + + theEncodeContext.pushPath(nextChildGenericName, false); BaseRuntimeElementDefinition childDef = childNameAndDef.getChildDef(); boolean primitive = childDef.getChildType() == ChildTypeEnum.PRIMITIVE_DATATYPE; @@ -451,20 +460,20 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } } - if (currentChildName == null || !currentChildName.equals(childName)) { + if (currentChildName == null || !currentChildName.equals(nextChildSpecificName)) { if (inArray) { theEventWriter.endArray(); } if (nextChild.getMax() > 1 || nextChild.getMax() == Child.MAX_UNLIMITED) { - beginArray(theEventWriter, childName); + beginArray(theEventWriter, nextChildSpecificName); inArray = true; encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, nextChildElem, force, theEncodeContext); } else if (nextChild instanceof RuntimeChildNarrativeDefinition && theContainedResource) { // suppress narratives from contained resources } else { - encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, childName, theContainedResource, nextChildElem, false, theEncodeContext); + encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, nextChildSpecificName, theContainedResource, nextChildElem, false, theEncodeContext); } - currentChildName = childName; + currentChildName = nextChildSpecificName; } else { encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, nextChildElem, force, theEncodeContext); } @@ -594,6 +603,11 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull, boolean theContainedResource, IIdType theResourceId, EncodeContext theEncodeContext) throws IOException { + + if (!super.shouldEncodeResource(theResDef.getName())) { + return; + } + if (!theContainedResource) { super.containResourcesForEncoding(theResource); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 70dfd9ac21e..88327cecede 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -215,9 +215,19 @@ public class XmlParser extends BaseParser /* implements IParser */ { } } - private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, IBase theElement, String childName, BaseRuntimeElementDefinition childDef, + private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, BaseRuntimeChildDefinition theChildDefinition, IBase theElement, String theChildName, BaseRuntimeElementDefinition childDef, String theExtensionUrl, boolean theIncludedResource, CompositeChildElement theParent, EncodeContext theEncodeContext) throws XMLStreamException, DataFormatException { - theEncodeContext.pushPath(childName, false); + + /* + * Often the two values below will be the same thing. There are cases though + * where they will not be. An example would be Observation.value, which is + * a choice type. If the value contains a Quantity, then: + * childGenericName = "value" + * theChildName = "valueQuantity" + */ + String childGenericName = theChildDefinition.getElementName(); + + theEncodeContext.pushPath(childGenericName, false); try { if (theElement == null || theElement.isEmpty()) { @@ -233,9 +243,9 @@ public class XmlParser extends BaseParser /* implements IParser */ { switch (childDef.getChildType()) { case ID_DATATYPE: { IIdType value = IIdType.class.cast(theElement); - String encodedValue = "id".equals(childName) ? value.getIdPart() : value.getValue(); + String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue(); if (StringUtils.isNotBlank(encodedValue) || !super.hasNoExtensions(value)) { - theEventWriter.writeStartElement(childName); + theEventWriter.writeStartElement(theChildName); if (StringUtils.isNotBlank(encodedValue)) { theEventWriter.writeAttribute("value", encodedValue); } @@ -248,7 +258,7 @@ public class XmlParser extends BaseParser /* implements IParser */ { IPrimitiveType pd = IPrimitiveType.class.cast(theElement); String value = pd.getValueAsString(); if (value != null || !super.hasNoExtensions(pd)) { - theEventWriter.writeStartElement(childName); + theEventWriter.writeStartElement(theChildName); String elementId = getCompositeElementId(theElement); if (isNotBlank(elementId)) { theEventWriter.writeAttribute("id", elementId); @@ -263,7 +273,7 @@ public class XmlParser extends BaseParser /* implements IParser */ { } case RESOURCE_BLOCK: case COMPOSITE_DATATYPE: { - theEventWriter.writeStartElement(childName); + theEventWriter.writeStartElement(theChildName); String elementId = getCompositeElementId(theElement); if (isNotBlank(elementId)) { theEventWriter.writeAttribute("id", elementId); @@ -291,9 +301,12 @@ public class XmlParser extends BaseParser /* implements IParser */ { break; } case RESOURCE: { - theEventWriter.writeStartElement(childName); IBaseResource resource = (IBaseResource) theElement; String resourceName = myContext.getResourceDefinition(resource).getName(); + if (!super.shouldEncodeResource(resourceName)) { + break; + } + theEventWriter.writeStartElement(theChildName); theEncodeContext.pushPath(resourceName, true); encodeResourceToXmlStreamWriter(resource, theEventWriter, false, theEncodeContext); theEncodeContext.popPath(); @@ -364,13 +377,13 @@ public class XmlParser extends BaseParser /* implements IParser */ { RuntimeChildNarrativeDefinition child = (RuntimeChildNarrativeDefinition) nextChild; String childName = nextChild.getChildNameByDatatype(child.getDatatype()); BaseRuntimeElementDefinition type = child.getChildByName(childName); - encodeChildElementToStreamWriter(theResource, theEventWriter, narr, childName, type, null, theContainedResource, nextChildElem, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, nextChild, narr, childName, type, null, theContainedResource, nextChildElem, theEncodeContext); continue; } } if (nextChild instanceof RuntimeChildContainedResources) { - encodeChildElementToStreamWriter(theResource, theEventWriter, null, nextChild.getChildNameByDatatype(null), nextChild.getChildElementDefinitionByDatatype(null), null, theContainedResource, nextChildElem, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, nextChild, null, nextChild.getChildNameByDatatype(null), nextChild.getChildElementDefinitionByDatatype(null), null, theContainedResource, nextChildElem, theEncodeContext); } else { List values = nextChild.getAccessor().getValues(theElement); @@ -402,11 +415,11 @@ public class XmlParser extends BaseParser /* implements IParser */ { continue; } } - encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, getExtensionUrl(extension.getUrl()), theContainedResource, nextChildElem, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, nextChild, nextValue, childName, childDef, getExtensionUrl(extension.getUrl()), theContainedResource, nextChildElem, theEncodeContext); } else if (nextChild instanceof RuntimeChildNarrativeDefinition && theContainedResource) { // suppress narratives from contained resources } else { - encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, extensionUrl, theContainedResource, nextChildElem, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, nextChild, nextValue, childName, childDef, extensionUrl, theContainedResource, nextChildElem, theEncodeContext); } } @@ -429,7 +442,7 @@ public class XmlParser extends BaseParser /* implements IParser */ { } theEventWriter.writeAttribute("url", extensionUrl); - encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, null, theContainedResource, nextChildElem, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, nextChild, nextValue, childName, childDef, null, theContainedResource, nextChildElem, theEncodeContext); theEventWriter.writeEndElement(); } @@ -471,15 +484,15 @@ public class XmlParser extends BaseParser /* implements IParser */ { } private void encodeResourceToXmlStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, boolean theContainedResource, IIdType theResourceId, EncodeContext theEncodeContext) throws XMLStreamException { - if (!theContainedResource) { - super.containResourcesForEncoding(theResource); - } - RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource); if (resDef == null) { throw new ConfigurationException("Unknown resource type: " + theResource.getClass()); } + if (!theContainedResource) { + super.containResourcesForEncoding(theResource); + } + theEventWriter.writeStartElement(resDef.getName()); theEventWriter.writeDefaultNamespace(FHIR_NS); @@ -609,7 +622,7 @@ public class XmlParser extends BaseParser /* implements IParser */ { throw new ConfigurationException("Unable to encode extension, unrecognized child element type: " + value.getClass().getCanonicalName()); } } - encodeChildElementToStreamWriter(theResource, theEventWriter, value, childName, childDef, null, theIncludedResource, null, theEncodeContext); + encodeChildElementToStreamWriter(theResource, theEventWriter, extDef, value, childName, childDef, null, theIncludedResource, null, theEncodeContext); } // child extensions diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java index 369aa6bd0b6..9aafeb9511c 100644 --- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java +++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jaxrs.server.util; * 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. @@ -19,206 +19,54 @@ package ca.uhn.fhir.jaxrs.server.util; * limitations under the License. * #L% */ -import java.io.*; -import java.nio.charset.Charset; -import java.util.Collections; -import java.util.List; - -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; - -import org.apache.commons.lang3.StringUtils; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.jaxrs.server.AbstractJaxRsProvider; -import ca.uhn.fhir.rest.api.*; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.RequestTypeEnum; +import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.IRestfulResponse; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.method.ResourceParameter; import ca.uhn.fhir.util.UrlUtil; +import org.apache.commons.lang3.StringUtils; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.nio.charset.Charset; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** - * The JaxRsRequest is a jax-rs specific implementation of the RequestDetails. - * + * The JaxRsRequest is a jax-rs specific implementation of the RequestDetails. + * * @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare */ public class JaxRsRequest extends RequestDetails { - /** - * An implementation of the builder pattern for the JaxRsRequest - */ - public static class Builder { - private String myCompartment; - private String myId; - private RequestTypeEnum myRequestType; - private String myRequestUrl; - private String myResource; - private final String myResourceName; - private RestOperationTypeEnum myRestOperation; - private AbstractJaxRsProvider myServer; - private String myVersion; - - /** - * Utility Constructor - * @param theServer the server - * @param theRequestType the request type - * @param theRestOperation the rest operation - * @param theRequestUrl - */ - public Builder(AbstractJaxRsProvider theServer, RequestTypeEnum theRequestType, - RestOperationTypeEnum theRestOperation, String theRequestUrl, String theResourceName) { - this.myServer = theServer; - this.myRequestType = theRequestType; - this.myRestOperation = theRestOperation; - this.myRequestUrl = theRequestUrl; - this.myResourceName = theResourceName; - } - - /** - * Create the jax-rs request - * @return the jax-rs request - */ - public JaxRsRequest build() { - JaxRsRequest result = new JaxRsRequest(myServer, myResource, myRequestType, myRestOperation); - if ((StringUtils.isNotBlank(myVersion) || StringUtils.isNotBlank(myCompartment)) - && StringUtils.isBlank(myId)) { - throw new InvalidRequestException("Don't know how to handle request path: " - + myServer.getUriInfo().getRequestUri().toASCIIString()); - } - - FhirVersionEnum fhirContextVersion = myServer.getFhirContext().getVersion().getVersion(); - - if (StringUtils.isNotBlank(myVersion)) { - switch (fhirContextVersion) { - case R4: - result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); - break; - case DSTU3: - result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); - break; - case DSTU2_1: - result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); - break; - case DSTU2_HL7ORG: - result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); - break; - case DSTU2: - result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); - break; - default: - throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); - } - } else if (StringUtils.isNotBlank(myId)) { - switch (fhirContextVersion) { - case R4: - result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); - break; - case DSTU3: - result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); - break; - case DSTU2_1: - result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); - break; - case DSTU2_HL7ORG: - result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); - break; - case DSTU2: - result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); - break; - default: - throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); - } - } - - if (myRestOperation == RestOperationTypeEnum.UPDATE) { - String contentLocation = result.getHeader(Constants.HEADER_CONTENT_LOCATION); - if (contentLocation != null) { - switch (fhirContextVersion) { - case R4: - result.setId(new org.hl7.fhir.r4.model.IdType(contentLocation)); - break; - case DSTU3: - result.setId(new org.hl7.fhir.dstu3.model.IdType(contentLocation)); - break; - case DSTU2_1: - result.setId(new org.hl7.fhir.dstu2016may.model.IdType(contentLocation)); - break; - case DSTU2_HL7ORG: - result.setId(new org.hl7.fhir.instance.model.IdType(contentLocation)); - break; - case DSTU2: - result.setId(new ca.uhn.fhir.model.primitive.IdDt(contentLocation)); - break; - default: - throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); - } - } - } - - result.setCompartmentName(myCompartment); - result.setCompleteUrl(myRequestUrl); - result.setResourceName(myResourceName); - - return result; - } - - /** - * Set the compartment - * @param compartment the compartment - * @return the builder - */ - public Builder compartment(String compartment) { - this.myCompartment = compartment; - return this; - } - - /** - * Set the id - * @param id the resource id - * @return the builder - */ - public Builder id(String id) { - this.myId = id; - return this; - } - - /** - * Set the resource - * @param resource the body contents of an http method - * @return the builder - */ - public Builder resource(String resource) { - this.myResource = resource; - return this; - } - - /** - * Set the id version - * @param version the version of the resource - * @return the builder - */ - public Builder version(String version) { - this.myVersion = version; - return this; - } - } - private HttpHeaders myHeaders; private String myResourceString; private AbstractJaxRsProvider myServer; + private Map myAttributes = new HashMap<>(); /** * Utility Constructor - * @param server the server + * + * @param server the server * @param resourceString the resource body - * @param requestType the request type - * @param restOperation the operation type + * @param requestType the request type + * @param restOperation the operation type */ public JaxRsRequest(AbstractJaxRsProvider server, String resourceString, RequestTypeEnum requestType, - RestOperationTypeEnum restOperation) { + RestOperationTypeEnum restOperation) { this.myHeaders = server.getHeaders(); this.myResourceString = resourceString; this.setRestOperationType(restOperation); @@ -231,17 +79,17 @@ public class JaxRsRequest extends RequestDetails { @Override protected byte[] getByteStreamRequestContents() { return StringUtils.defaultString(myResourceString, "") - .getBytes(ResourceParameter.determineRequestCharset(this)); + .getBytes(ResourceParameter.determineRequestCharset(this)); } @Override public Charset getCharset() { String charset = null; - - if(myHeaders.getMediaType() != null && myHeaders.getMediaType().getParameters() != null) { + + if (myHeaders.getMediaType() != null && myHeaders.getMediaType().getParameters() != null) { charset = myHeaders.getMediaType().getParameters().get(MediaType.CHARSET_PARAMETER); } - if(charset != null) { + if (charset != null) { return Charset.forName(charset); } else { return null; @@ -262,7 +110,17 @@ public class JaxRsRequest extends RequestDetails { @Override public List getHeaders(String name) { List requestHeader = myHeaders.getRequestHeader(name); - return requestHeader == null ? Collections. emptyList() : requestHeader; + return requestHeader == null ? Collections.emptyList() : requestHeader; + } + + @Override + public Object getAttribute(String theAttributeName) { + return myAttributes.get(theAttributeName); + } + + @Override + public void setAttribute(String theAttributeName, Object theAttributeValue) { + myAttributes.put(theAttributeName, theAttributeValue); } @Override @@ -290,16 +148,182 @@ public class JaxRsRequest extends RequestDetails { return myServer; } + /** + * Set the server + * + * @param theServer the server to set + */ + public void setServer(AbstractJaxRsProvider theServer) { + this.myServer = theServer; + } + @Override public String getServerBaseForRequest() { return getServer().getServerAddressStrategy().determineServerBase(null, null); } /** - * Set the server - * @param theServer the server to set + * An implementation of the builder pattern for the JaxRsRequest */ - public void setServer(AbstractJaxRsProvider theServer) { - this.myServer = theServer; + public static class Builder { + private final String myResourceName; + private String myCompartment; + private String myId; + private RequestTypeEnum myRequestType; + private String myRequestUrl; + private String myResource; + private RestOperationTypeEnum myRestOperation; + private AbstractJaxRsProvider myServer; + private String myVersion; + + /** + * Utility Constructor + * + * @param theServer the server + * @param theRequestType the request type + * @param theRestOperation the rest operation + * @param theRequestUrl + */ + public Builder(AbstractJaxRsProvider theServer, RequestTypeEnum theRequestType, + RestOperationTypeEnum theRestOperation, String theRequestUrl, String theResourceName) { + this.myServer = theServer; + this.myRequestType = theRequestType; + this.myRestOperation = theRestOperation; + this.myRequestUrl = theRequestUrl; + this.myResourceName = theResourceName; + } + + /** + * Create the jax-rs request + * + * @return the jax-rs request + */ + public JaxRsRequest build() { + JaxRsRequest result = new JaxRsRequest(myServer, myResource, myRequestType, myRestOperation); + if ((StringUtils.isNotBlank(myVersion) || StringUtils.isNotBlank(myCompartment)) + && StringUtils.isBlank(myId)) { + throw new InvalidRequestException("Don't know how to handle request path: " + + myServer.getUriInfo().getRequestUri().toASCIIString()); + } + + FhirVersionEnum fhirContextVersion = myServer.getFhirContext().getVersion().getVersion(); + + if (StringUtils.isNotBlank(myVersion)) { + switch (fhirContextVersion) { + case R4: + result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); + break; + case DSTU3: + result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); + break; + case DSTU2_1: + result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); + break; + case DSTU2_HL7ORG: + result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); + break; + case DSTU2: + result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); + break; + default: + throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); + } + } else if (StringUtils.isNotBlank(myId)) { + switch (fhirContextVersion) { + case R4: + result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); + break; + case DSTU3: + result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); + break; + case DSTU2_1: + result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); + break; + case DSTU2_HL7ORG: + result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); + break; + case DSTU2: + result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); + break; + default: + throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); + } + } + + if (myRestOperation == RestOperationTypeEnum.UPDATE) { + String contentLocation = result.getHeader(Constants.HEADER_CONTENT_LOCATION); + if (contentLocation != null) { + switch (fhirContextVersion) { + case R4: + result.setId(new org.hl7.fhir.r4.model.IdType(contentLocation)); + break; + case DSTU3: + result.setId(new org.hl7.fhir.dstu3.model.IdType(contentLocation)); + break; + case DSTU2_1: + result.setId(new org.hl7.fhir.dstu2016may.model.IdType(contentLocation)); + break; + case DSTU2_HL7ORG: + result.setId(new org.hl7.fhir.instance.model.IdType(contentLocation)); + break; + case DSTU2: + result.setId(new ca.uhn.fhir.model.primitive.IdDt(contentLocation)); + break; + default: + throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion); + } + } + } + + result.setCompartmentName(myCompartment); + result.setCompleteUrl(myRequestUrl); + result.setResourceName(myResourceName); + + return result; + } + + /** + * Set the compartment + * + * @param compartment the compartment + * @return the builder + */ + public Builder compartment(String compartment) { + this.myCompartment = compartment; + return this; + } + + /** + * Set the id + * + * @param id the resource id + * @return the builder + */ + public Builder id(String id) { + this.myId = id; + return this; + } + + /** + * Set the resource + * + * @param resource the body contents of an http method + * @return the builder + */ + public Builder resource(String resource) { + this.myResource = resource; + return this; + } + + /** + * Set the id version + * + * @param version the version of the resource + * @return the builder + */ + public Builder version(String version) { + this.myVersion = version; + return this; + } } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java index aee27813903..aa1628baa74 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java @@ -1165,6 +1165,22 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } + @Test + public void testElements() throws IOException { + DiagnosticReport dr = new DiagnosticReport(); + dr.setStatus(DiagnosticReport.DiagnosticReportStatus.FINAL); + dr.getCode().setText("CODE TEXT"); + ourClient.create().resource(dr).execute(); + + HttpGet get = new HttpGet(ourServerBase + "/DiagnosticReport?_include=DiagnosticReport:result&_elements:exclude=DiagnosticReport&_elements=DiagnosticReport:status,Observation:value,Observation:code,Observation:subject&_pretty=true"); + try (CloseableHttpResponse response = ourHttpClient.execute(get)) { + assertEquals(200, response.getStatusLine().getStatusCode()); + String output = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); + assertThat(output, not(containsString(" myInterceptors = new ArrayList<>(); private final List myPlainProviders = new ArrayList<>(); private final List myResourceProviders = new ArrayList<>(); @@ -499,6 +499,19 @@ public class RestfulServer extends HttpServlet implements IRestfulServernull. Default is + * {@link #DEFAULT_ETAG_SUPPORT} + * + * @param theETagSupport The ETag support mode + */ + public void setETagSupport(ETagSupportEnum theETagSupport) { + if (theETagSupport == null) { + throw new NullPointerException("theETagSupport can not be null"); + } + myETagSupport = theETagSupport; + } + @Override public ElementsSupportEnum getElementsSupport() { return myElementsSupport; @@ -514,19 +527,6 @@ public class RestfulServer extends HttpServlet implements IRestfulServernull. Default is - * {@link #DEFAULT_ETAG_SUPPORT} - * - * @param theETagSupport The ETag support mode - */ - public void setETagSupport(ETagSupportEnum theETagSupport) { - if (theETagSupport == null) { - throw new NullPointerException("theETagSupport can not be null"); - } - myETagSupport = theETagSupport; - } - /** * Gets the {@link FhirContext} associated with this server. For efficient processing, resource providers and plain * providers should generally use this context if one is needed, as opposed to @@ -933,21 +933,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer resourceMethod = determineResourceMethod(requestDetails, requestPath); @@ -1049,6 +1035,26 @@ public class RestfulServer extends HttpServlet implements IRestfulServer emptyList() : Collections.list(getServletRequest().getHeaders(name)); } + @Override + public Object getAttribute(String theAttributeName) { + Validate.notBlank(theAttributeName, "theAttributeName must not be null or blank"); + return getServletRequest().getAttribute(theAttributeName); + } + + @Override + public void setAttribute(String theAttributeName, Object theAttributeValue) { + Validate.notBlank(theAttributeName, "theAttributeName must not be null or blank"); + getServletRequest().setAttribute(theAttributeName, theAttributeValue); + } + @Override public InputStream getInputStream() throws IOException { return getServletRequest().getInputStream(); diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java index 38104c562eb..146bde73e3d 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java @@ -18,10 +18,7 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.*; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.*; import java.io.IOException; import java.util.Collection; @@ -30,7 +27,8 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; public class ElementsParamR4Test { @@ -42,6 +40,7 @@ public class ElementsParamR4Test { private static Server ourServer; private static Procedure ourNextProcedure; private static RestfulServer ourServlet; + private static Observation ourNextObservation; @Before public void before() { @@ -50,6 +49,92 @@ public class ElementsParamR4Test { ourServlet.setElementsSupport(new RestfulServer().getElementsSupport()); } + @Test + public void testElementsOnChoiceWithGenericName() throws IOException { + createObservationWithQuantity(); + verifyXmlAndJson( + "http://localhost:" + ourPort + "/Observation?_elements=value,status", + bundle -> { + Observation obs = (Observation) bundle.getEntry().get(0).getResource(); + assertEquals("SUBSETTED", obs.getMeta().getTag().get(0).getCode()); + assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); + assertEquals("222", obs.getValueQuantity().getValueElement().getValueAsString()); + assertEquals("mg", obs.getValueQuantity().getCode()); + }); + } + + @Test + public void testElementsOnChoiceWithSpecificName() throws IOException { + createObservationWithQuantity(); + verifyXmlAndJson( + "http://localhost:" + ourPort + "/Observation?_elements=valueQuantity,status", + bundle -> { + Observation obs = (Observation) bundle.getEntry().get(0).getResource(); + assertEquals("SUBSETTED", obs.getMeta().getTag().get(0).getCode()); + assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); + assertEquals("222", obs.getValueQuantity().getValueElement().getValueAsString()); + assertEquals("mg", obs.getValueQuantity().getCode()); + }); + } + + @Test + @Ignore + public void testElementsOnChoiceWithSpecificNameNotMatching() throws IOException { + createObservationWithQuantity(); + verifyXmlAndJson( + "http://localhost:" + ourPort + "/Observation?_elements=valueString,status", + bundle -> { + Observation obs = (Observation) bundle.getEntry().get(0).getResource(); + assertEquals("SUBSETTED", obs.getMeta().getTag().get(0).getCode()); + assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); + assertEquals(null, obs.getValueQuantity()); + }); + } + + @Test + public void testExcludeResources() throws IOException { + createProcedureWithLongChain(); + verifyXmlAndJson( + "http://localhost:" + ourPort + "/Procedure?_include=*&_elements:exclude=Procedure,DiagnosticReport,*.meta", + bundle -> { + assertEquals(null, bundle.getEntry().get(0).getResource()); + assertEquals(null, bundle.getEntry().get(1).getResource()); + + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); + assertEquals(true, obs.getMeta().isEmpty()); + assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); + assertEquals(1, obs.getCode().getCoding().size()); + assertEquals("STRING VALUE", obs.getValueStringType().getValue()); + }); + } + + @Test + public void testInvalidInclude() throws IOException { + createProcedureWithLongChain(); + EncodingEnum encodingEnum; + HttpGet httpGet; + + encodingEnum = EncodingEnum.JSON; + httpGet = new HttpGet(("http://localhost:" + ourPort + "/Procedure?_include=*&_elements=DiagnosticReport:foo") + "&_pretty=true&_format=" + encodingEnum.getFormatContentType()); + try (CloseableHttpResponse status = ourClient.execute(httpGet)) { + String responseContent = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8); + ourLog.info(responseContent); + assertEquals(400, status.getStatusLine().getStatusCode()); + } + + } + + private void createObservationWithQuantity() { + ourNextObservation = new Observation(); + ourNextObservation.setId("Observation/123/_history/456"); + ourNextObservation.setStatus(Observation.ObservationStatus.FINAL); + ourNextObservation.setSubject(new Reference("Patient/AAA")); + ourNextObservation.setValue(new Quantity() + .setValue(222) + .setCode("mg") + .setSystem("http://unitsofmeasure.org")); + } + @Test public void testReadSummaryData() throws Exception { verifyXmlAndJson( @@ -108,7 +193,7 @@ public class ElementsParamR4Test { assertThat(responseContent, containsString("THE DIV")); assertThat(responseContent, not(containsString("family"))); assertThat(responseContent, not(containsString("maritalStatus"))); - assertThat(ourLastElements, containsInAnyOrder( "text")); + assertThat(ourLastElements, containsInAnyOrder("text")); } ); } @@ -132,14 +217,13 @@ public class ElementsParamR4Test { assertEquals(0, dr.getMeta().getTag().size()); assertEquals("Observation/OBSA", dr.getResult().get(0).getReference()); - Observation obs = (Observation ) bundle.getEntry().get(2).getResource(); + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); assertEquals(0, obs.getMeta().getTag().size()); assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); assertEquals("1234-5", obs.getCode().getCoding().get(0).getCode()); }); } - @Test public void testMultiResourceElementsFilter() throws IOException { createProcedureWithLongChain(); @@ -154,7 +238,7 @@ public class ElementsParamR4Test { DiagnosticReport dr = (DiagnosticReport) bundle.getEntry().get(1).getResource(); assertEquals(0, dr.getMeta().getTag().size()); - Observation obs = (Observation ) bundle.getEntry().get(2).getResource(); + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); assertEquals("SUBSETTED", obs.getMeta().getTag().get(0).getCode()); assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); assertEquals(0, obs.getCode().getCoding().size()); @@ -176,7 +260,7 @@ public class ElementsParamR4Test { DiagnosticReport dr = (DiagnosticReport) bundle.getEntry().get(1).getResource(); assertEquals(true, dr.getMeta().isEmpty()); - Observation obs = (Observation ) bundle.getEntry().get(2).getResource(); + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); assertEquals(true, obs.getMeta().isEmpty()); assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); assertEquals(0, obs.getCode().getCoding().size()); @@ -203,7 +287,7 @@ public class ElementsParamR4Test { assertEquals(true, dr.getMeta().isEmpty()); assertEquals(1, dr.getResult().size()); - Observation obs = (Observation ) bundle.getEntry().get(2).getResource(); + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); assertEquals("SUBSETTED", obs.getMeta().getTag().get(0).getCode()); assertEquals(null, obs.getStatus()); assertEquals(0, obs.getCode().getCoding().size()); @@ -228,7 +312,7 @@ public class ElementsParamR4Test { assertEquals(true, dr.getMeta().isEmpty()); assertEquals(1, dr.getResult().size()); - Observation obs = (Observation ) bundle.getEntry().get(2).getResource(); + Observation obs = (Observation) bundle.getEntry().get(2).getResource(); assertEquals(true, obs.getMeta().isEmpty()); assertEquals(Observation.ObservationStatus.FINAL, obs.getStatus()); assertEquals(1, obs.getCode().getCoding().size()); @@ -297,6 +381,21 @@ public class ElementsParamR4Test { } } + public static class DummyObservationResourceProvider implements IResourceProvider { + + + @Override + public Class getResourceType() { + return Observation.class; + } + + @Search + public Observation search(@IncludeParam(allow = {"*"}) Collection theIncludes) { + return ourNextObservation; + } + + } + public static class DummyProcedureResourceProvider implements IResourceProvider { @Override @@ -358,6 +457,8 @@ public class ElementsParamR4Test { ourServlet.registerProvider(new DummyPatientResourceProvider()); ourServlet.registerProvider(new DummyProcedureResourceProvider()); + ourServlet.registerProvider(new DummyObservationResourceProvider()); + ServletHolder servletHolder = new ServletHolder(ourServlet); proxyHandler.addServletWithMapping(servletHolder, "/*"); ourServer.setHandler(proxyHandler); diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9cb5715a1b0..83a9e488e1b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -6,6 +6,17 @@ HAPI FHIR Changelog + + + In Servers that are configured to support extended mode + _elements]]> parameters, it is now possible to + use the :exclude modifier to exclude entire resource types. + + + RequestDetails now has methods called getAttribute and setAttribute that can + be used by interceptors to pass arbitrary data between requests. + + HAPI FHIR is now built using OpenJDK 11. Users are recommended to upgrade to this version @@ -544,7 +555,6 @@ date was corrected. Thanks Heinz-Dieter Conradi for the Pull Request! - HAPI FHIR now supports JDK 9 and JDK 10, both for building HAPI FHIR @@ -6102,7 +6112,7 @@ Bundle bundle = client.search().forResource(Patient.class) API CHANGE:]]>: Most elements in the HAPI FHIR model contain a getId() and setId() method. This method is confusing because it is only actually used for IDREF elements (which are rare) but its name makes it easy to confuse with more - important identifiers. For this reason, these methods have been deprocated and replaced with + important identifiers. For this reason, these methods have been deprecated and replaced with get/setElementSpecificId() methods. The old methods will be removed at some point. Resource types are unchanged and retain their get/setId methods.