From 3454104296ac486b19d66ac8742c441d226dc64d Mon Sep 17 00:00:00 2001 From: Shubham Parikh Date: Thu, 16 Mar 2023 18:38:24 +0530 Subject: [PATCH] Dev (#48) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updated dockerfile to use root user before creating directory * Updated hapi-fhir dependency version to 6.2.5 (#44) * reverted dockerfile which was earlier modified to test build issue on jenkins * Added newline in Dockerfile * 6.4.0 (#47) * registering ValueSetOperationProvider * Upgrade to 5.7.0-PRE4-SNAPSHOT for testing * Share elasticsearch configuration * Fixed compile issues * Fix misconfiguration modelConfig is part of DaoConfig and should not have a separate lifecycle. * Bump to 5.7.0-PRE8-SNAPSHOT * Typo fix in README * Add configuration flag to enable storing of resources in lucene index (#304) * Add configuration flag to enable storing of resources in lucene index * Fix build issue * Fix code review suggestions Co-authored-by: Jaison B * Add ES native aggregation builder for lastN * Revert "Add ES native aggregation builder for lastN" This reverts commit 5312f78b956d4ad4863580035972263586d616c3. * bump version * Update for 5.7.x changes * Fix h2 dialect, replace mail dep * Bump postgresql from 42.2.23 to 42.2.25 Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.23 to 42.2.25. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.23...REL42.2.25) --- updated-dependencies: - dependency-name: org.postgresql:postgresql dependency-type: direct:production ... Signed-off-by: dependabot[bot] * bump Hapi PRE version * Bump to Hapi 6.0-SNAPSHOT and register the ValueSet provider. * Version bump to 5.7.0 and a few other components now draw the version from parent * Update application.yaml Momentarily added `allow-circular-references: true` * bump to real version * Bump version * Remove search coord thread pool * Added instructions about removing Hibernate dialect To fix the problem raised in [this](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/318) issue. * Bump HAPI-FHIR version * Move to newlines * fix to work with latest hapi-fhir * Feature/update docker support (#319) * Updated docker image according to discussion on https://github.com/hapifhir/hapi-fhir-jpaserver-starter/pull/305 * Added doc * Added corrections according to comments * Update Dockerfile * Update build-images.yaml Updated to default to distroless * add dao_scheduling_enabled configuration property (#324) * added reindexProvider to Config (#326) * Update application.yaml * Update application.yaml Roll back - mistake from my side * Bump hapi-fhir version to 'PRE5' (#329) * Add actuator * Bump to PRE8 * disable springboot actuator endpoints other than 'health' for security reasons (#338) Co-authored-by: Craig McClendon * Bump to PRE9 * Update application.yaml (#345) * add support for ms sql server (#347) * Fix comments in Demo that lead to 404 (#348) Co-authored-by: dotasek * updated helm chart to use v5.7.0 and latest PostgreSQL sub-chart (#346) * Update application.yaml Reverted to sane defaults * Bump to PRE10 * Updated to HAPI FHIR version 5.7.2 (#349) * Revert accidental default activation of experimental lucene indexing * Add disclaimer for advanced_lucene_indexing added warning to advanced_lucene_indexing: false property * Bump to hapi PRE11 * Expose Prometheus metrics (#355) * Add: of-type modifier option in application.yaml (#363) Co-authored-by: Alejandro Medina * Fix applying supported_resource_types option with list that already includes SearchParameter (#365) * Bump pom and minimum java version * Bump ES version * hibernate search application properties updates. * make lastN test pass * Remove value set provider as it causes a boot failure without lucene * Fix reindex provider * Bump java version for test * Bump to pre-01 * fix build * Re-add valuesetoperation provider * Disable lucene by default * Re-add valueset operation provider * adding smoke test files * adding base documentation * wip * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * bumping to non-snapshot version (#377) * updated helm chart to use latest v6.0.1 version of the image (#382) * updated helm chart to use latest v6.0.1 version of the image * updated workflow to run against multiple k8s versions * add BinaryAccessProvider to BaseJpaRestfulServer * Update src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> * Applying fix from upstream for h2 Binaries This issue is already fixed upstream. Can be removed with next hapi version upgrade. https://github.com/hapifhir/hapi-fhir/pull/3676 * removed wrong and duplicated config entry `daoconfig_client_id_strategy`does not resolve and is a duplicate of `client_id_strategy` * Added OpenTelemetry Java Agent JAR to container image (#391) Closes #387 * changes to pom.xml to enable publishing * fixed directory of the .war in tomcat-based image * bulk data instrumentation included * bulk data instrumentation turned off by default * updated opentelemetry-java-instrumentation JAR to 1.16.0 * Better support for ARM java17 regular doesn't have ARM, java17-debian11 does * Updated Otel Java agent to 1.17.0 * Updated hapi-fhir to 6.1.0 * Minor Helm chart dependency updates and security improvements * Don't run maven CI on changes to the helm chart * updated helm chart to use version 6.1.0 of the image * added appProperties.getInline_resource_storage_below_size() (#420) * added appProperties.getInline_resource_storage_below_size() * indentations * Feat/restructuring (#422) * Did restructuring and made repo validation interceptor an optional bean instead as it makes it more clean * Moved construction of FHIR servlet into a bean for better reuse of others that would like to depend directly on this library * Disabled default validation enabled * Extract IG loading (#426) * added back lost config entry: allowed_bundle_types (#427) * added back lost config entry * disabled entry * Bump snakeyaml from 1.30 to 1.31 Bumps [snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 1.30 to 1.31. - [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-1.31..snakeyaml-1.30) --- updated-dependencies: - dependency-name: org.yaml:snakeyaml dependency-type: direct:production ... Signed-off-by: dependabot[bot] * fix: configuration of cors Refs: #430 * Proper close DB connection after dialect was resolved (#435) * removed duplicated and wrong subscription code (#440) * fixed SubscriptionDebugLogInterceptor adding logic * switch to postgres db (#444) * revering to H2 (#449) * Tracking Hapi 6.2-PRE releases (#408) * Tracking branch for 6.1 pre-releases. * Update to 6.1.0-PRE3-SNAPSHOT * Adjust for hapi-fhir namespace changes and version * Adjust version to include new hapi-fhir HSearch fast path feature * Bump hapi PRE * Update to PRE16 * Adjust configuration class name to HAPI-FHIR HSearch namespace consolidation. Add commented out sample properties for lucene and elastic. Move batch.job.enabled property under spring: prefix to have it considered. * Adjust enumeration renaming * Repoint FHIR 6.2.0-PRE1-SNAPSHOT * Add missing Bean to starter configuration * Update to hapi-fhir 6.2.0-PRE2-SNAPSHOT * Update application-integrationtest.yaml and rename it as application.yaml to make test configuration independent of prod. * Update to hapi-fhir 6.2.0-PRE5-SNAPSHOT * Update dep * Bump version fix failures * Remove dead import * Fix up * remove batch refs Co-authored-by: Michael Buckley Co-authored-by: michaelabuckley Co-authored-by: juan.marchionatto Co-authored-by: Tadgh * Added hibernate.dialect for Postgress to Readme (#451) * fixes for support of R4B / 6.2.0 (#455) * upping hapi version to 6.2.1 * Updated Helm chart to use image 6.2.1 and latest PostgreSQL (#458) * Bumped version (#462) * allow interceptors to be registered via properties * Update pom.xml to reference hapi-fhir 6.3.6-SNAPSHOT. This hapi-fhir release contains a fix for POSTing an XML resource with comments results in a fhir_comments error (#465) * Update pom.xml to reference hapi-fhir 6.3.4-SNAPSHOT. This also involves renaming websocket dependencies whose names have changed since 6.2.2 (ex websocket-api to websocket-jetty-api). * Update pom to reference logback 1.2.10 explicitly to resolve the missing StaticLoggerBinder errors. * Fix logback issue by pulling the same logback version as hapi-fhir and setting the following system property at boot: org.springframework.boot.logging.LoggingSystem=none. Also, fix the hapi-fhir-jpaserver-base dependency error by setting this in application.yaml: allow-bean-definition-overriding: true * Set allow-bean-definition-overriding: true on test application.yaml as well. * Remove lines in ExampleServerR4BIT that causes an implementation guide version error. * Upgrade to 6.3.6-SNAPSHOT and once again disable allow-bean-definition-overriding. Also remove the Bean for IMdmLinkDoa from StartJpaConfig and the Bean for ITermCodeSystemStorageSvc in FhirServerConfigDstu2. * Explicitly use logback 1.2.10 for both logback-classic and logback-core to resolve StaticBinderLogger not found errors. Also, remove explici logger disabling code in Application.java. * Restore Application.java as well as both application.yaml files to the same as master. * Feature/static files (#456) * Added mapping * Added documentation * Remove old junit4 usage. * Revert "Update pom.xml to reference hapi-fhir 6.3.6-SNAPSHOT. This hapi-fhir release contains a fix for POSTing an XML resource with comments results in a fhir_comments error (#465)" (#476) This reverts commit 9a513cd1845723c630565ac2b124d74e56491006. * Restore rolled back changes to ExampleServerR4BIT that pass unnecessary properties that will cause problems when using hapi-fhir 6.3.6-SNAPSHOT. (#479) * First commit to restore hapi-fhir 6.3.6-SNAPSHOT changes. Add static code blocks to Application.java as well as all tests to System.setProperty("org.springframework.boot.logging.LoggingSystem", "none"); * Feature/index default (#475) * Added default * Refactored the default resolution * Updated Helm chart to use hapi fhir image 6.2.2 (#472) * Implement a new solution: Instead of static code blocks disabling logging, rollback slf4j-api, logback-classic, and logback-core to older versions. It's the addition of the rollback for slf4j-api that seems to restore logging. * Fix tests for websocket * Update pipeline to run integration tests. * Initial IPS + Cql to Cr migration * Allow Enabling IPS via config * typo * CQL to CR * HAPI FHIR bump * docs: Updated README.md. Discontinue mysql * removed mysql-connector-java dependency since no longer supported and due to CVE-2022-3171 in transitive dependency on protobuf-java-3.19.4 * docs: Fix postgresql typo in docker-compose * docs: Explicitly set hibnerate.search.enabled to false if database is postgresql * refactor: Separate unrelated settings and documentation * docs: Explicitly set hibernate.search.enabled to false if database is postgress in docker-compose instructions * docs: Revert dislaimer in postgres * Bump Hapi * Fix Application error regarding multiple beans * Add optional explicit ip config for smoke tests * Revert "Add optional explicit ip config for smoke tests" This reverts commit afcd2fc13138c5f105d81932a473d9afbf2398fe. * Dev (#45) * updated dockerfile to use root user before creating directory * Updated hapi-fhir dependency version to 6.2.5 (#44) * reverted dockerfile which was earlier modified to test build issue on jenkins * Added newline in Dockerfile * Changes how the capability statement is implemented (#46) * Added custom property file * SAP-1596 Updated custom property file to read values from env * SAP-1687 Updated code to allow metadata request for server healthcheck (#7) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated docker compose file with required env variables * SAP-1656 Added enabled parameter for webservlet to enable/disable webapp (#4) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated code to read url pattern from environment. (#10) * BT-96 Added OAuth support * BT-96 Fixed indentation * BT-96 Fixed spacing * BT-96 Removed unwanted filed * Changes in code as per PR suggestions * added rest security extension in metadata * Updated PR as per suggestions * Updated README.md file to run the app with custom property file & env variables * Updated PR as per suggestions * Added user role validation in Oauth * code refactor * Updated code for using single oauth user role * Updated code as per PR suggestions * Updated code as pr PR siggestions * Added suppoet of delete operation to admin only * Refactored code * Added custom search narrowing filter * Updated code to work with oauth disabled * Updated code to get claim name from environment * change claim name env varible to proper name * Updated code to use hard-coded claim name * Changed custom mapper claim name to patient from subject * Added rule builder to filter resources * code refactor * Update CustomAuthorizationInterceptor.java * updated code to support operations on bundle resources * Added consent rule to allow patch request * Added oauth support for task resource * Updated code to make refrence check generic method * Updated method names * Updated code as per PR suggestions * Update code as per PR suggestion * Updated code as per PR * Added verification of clientId from token * Added basic authentication * Code refactor * Added username/password check while checking is basic auth enabled * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated docker compose file with required env variables * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * BT-80 Updated code to allow header x-api-key * BT-140 set legacy sql builder based on hibernate to true * BT-96 Fixed spacing * BT-96 Removed unwanted filed * Changes in code as per PR suggestions * Added user role validation in Oauth * code refactor * Updated code for using single oauth user role * Updated code as per PR suggestions * Updated code as pr PR siggestions * Added custom search narrowing filter * Updated code to get claim name from environment * Added rule builder to filter resources * code refactor * Added basic authentication * Added hibernate physical_naming_strategy to use proper table names. * updated code to use url mapping from environment * Removed client id validation from oauth token * fixed indentation * PT-669 Updated dockerfile to use user dir path for build * Sync 6.1.0 (#38) * Bump dep version * Remove javamail and replace with simple-java-mail * WIP * Remove print * Remove bean override * Bump version * Add broken test * Update for new style of container bean * Bump for new version * Update to 5.6.0-PRE7_NIH-SNAPSHOT and activate advanced index * Disable default flyway processing * Add local_base_urls configuration to feed DaoConfig.setTreatBaseUrlsAsLocal() * Added OpenAPI / Swagger option * Upgraded to 5.6.0 Subscription tests fail ... * Bumped version of Spring Boot in order to fix same issue as https://github.com/Haulmont/jmix-security/issues/90 * Update application.yaml See https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/292 * documented use of Values.extraEnv * added options for specifying a PodDisruptionBudget * simplified chart release workflow the Ubuntu runner base image already includes Helm 3.7.0 * Support HTTPS * Use default application.yaml * registering ValueSetOperationProvider * Upgrade to 5.7.0-PRE4-SNAPSHOT for testing * Share elasticsearch configuration * Fixed compile issues * Fix misconfiguration modelConfig is part of DaoConfig and should not have a separate lifecycle. * Bump to 5.7.0-PRE8-SNAPSHOT * Typo fix in README * Add configuration flag to enable storing of resources in lucene index (#304) * Add configuration flag to enable storing of resources in lucene index * Fix build issue * Fix code review suggestions Co-authored-by: Jaison B * Add ES native aggregation builder for lastN * Revert "Add ES native aggregation builder for lastN" This reverts commit 5312f78b956d4ad4863580035972263586d616c3. * bump version * Update for 5.7.x changes * Fix h2 dialect, replace mail dep * Bump postgresql from 42.2.23 to 42.2.25 Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.23 to 42.2.25. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.23...REL42.2.25) --- updated-dependencies: - dependency-name: org.postgresql:postgresql dependency-type: direct:production ... Signed-off-by: dependabot[bot] * bump Hapi PRE version * Bump to Hapi 6.0-SNAPSHOT and register the ValueSet provider. * Version bump to 5.7.0 and a few other components now draw the version from parent * Update application.yaml Momentarily added `allow-circular-references: true` * bump to real version * Bump version * Remove search coord thread pool * Added instructions about removing Hibernate dialect To fix the problem raised in [this](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/318) issue. * Bump HAPI-FHIR version * Move to newlines * fix to work with latest hapi-fhir * Feature/update docker support (#319) * Updated docker image according to discussion on https://github.com/hapifhir/hapi-fhir-jpaserver-starter/pull/305 * Added doc * Added corrections according to comments * Update Dockerfile * Update build-images.yaml Updated to default to distroless * add dao_scheduling_enabled configuration property (#324) * added reindexProvider to Config (#326) * Update application.yaml * Update application.yaml Roll back - mistake from my side * Bump hapi-fhir version to 'PRE5' (#329) * Add actuator * Bump to PRE8 * disable springboot actuator endpoints other than 'health' for security reasons (#338) Co-authored-by: Craig McClendon * Bump to PRE9 * Update application.yaml (#345) * add support for ms sql server (#347) * Fix comments in Demo that lead to 404 (#348) Co-authored-by: dotasek * updated helm chart to use v5.7.0 and latest PostgreSQL sub-chart (#346) * Update application.yaml Reverted to sane defaults * Bump to PRE10 * Updated to HAPI FHIR version 5.7.2 (#349) * Revert accidental default activation of experimental lucene indexing * Add disclaimer for advanced_lucene_indexing added warning to advanced_lucene_indexing: false property * Bump to hapi PRE11 * Expose Prometheus metrics (#355) * Add: of-type modifier option in application.yaml (#363) Co-authored-by: Alejandro Medina * Fix applying supported_resource_types option with list that already includes SearchParameter (#365) * Bump pom and minimum java version * Bump ES version * hibernate search application properties updates. * make lastN test pass * Remove value set provider as it causes a boot failure without lucene * Fix reindex provider * Bump java version for test * Bump to pre-01 * fix build * Re-add valuesetoperation provider * Disable lucene by default * Re-add valueset operation provider * adding smoke test files * adding base documentation * wip * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * bumping to non-snapshot version (#377) * updated helm chart to use latest v6.0.1 version of the image (#382) * updated helm chart to use latest v6.0.1 version of the image * updated workflow to run against multiple k8s versions * Tracking branch for 6.1 pre-releases. * add BinaryAccessProvider to BaseJpaRestfulServer * Update to 6.1.0-PRE3-SNAPSHOT * Update src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> * Adjust for hapi-fhir namespace changes and version * Adjust version to include new hapi-fhir HSearch fast path feature * Bump hapi PRE * Update to PRE16 * Adjust configuration class name to HAPI-FHIR HSearch namespace consolidation. Add commented out sample properties for lucene and elastic. Move batch.job.enabled property under spring: prefix to have it considered. * Bump to release * Add missing bean * Added custom property file * SAP-1596 Updated custom property file to read values from env * SAP-1687 Updated code to allow metadata request for server healthcheck (#7) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * BT-80 Updated code to allow header x-api-key * Updated docker compose file with required env variables * SAP-1656 Added enabled parameter for webservlet to enable/disable webapp (#4) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated code to read url pattern from environment. (#10) * BT-140 set legacy sql builder based on hibernate to true * BT-96 Added OAuth support * BT-96 Fixed indentation * BT-96 Fixed spacing * BT-96 Removed unwanted filed * Changes in code as per PR suggestions * added rest security extension in metadata * code refactor * Updated PR as per suggestions * Updated README.md file to run the app with custom property file & env variables * Updated PR as per suggestions * Added user role validation in Oauth * code refactor * Updated code for using single oauth user role * Updated code as per PR suggestions * Updated code as pr PR siggestions * Added suppoet of delete operation to admin only * Refactored code * Added custom search narrowing filter * Updated code to work with oauth disabled * Updated code to get claim name from environment * change claim name env varible to proper name * Updated code to use hard-coded claim name * Changed custom mapper claim name to patient from subject * Added rule builder to filter resources * code refactor * Update CustomAuthorizationInterceptor.java * updated code to support operations on bundle resources * Added consent rule to allow patch request * Added oauth support for task resource * Updated code to make refrence check generic method * Updated method names * Updated code as per PR suggestions * Update code as per PR suggestion * Updated code as per PR * Added verification of clientId from token * Added basic authentication * Code refactor * Added username/password check while checking is basic auth enabled * Added custom property file * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated docker compose file with required env variables * Update docker-compose.yml Updated file as per suggestions * Added custom property file * SAP-1596 Updated custom property file to read values from env * SAP-1667 Added interceptor for authorization (#5) * SAP-1667 Added interceptor for authorization * SAP-1667 Removed unused space. * SAP-1667 Added newline at the end of the file. Co-authored-by: Shubham Parikh <> * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * BT-96 Fixed spacing * BT-96 Removed unwanted filed * added rest security extension in metadata * code refactor * Update JpaRestfulServer.java * Updated PR as per suggestions * Added user role validation in Oauth * code refactor * Updated code for using single oauth user role * Updated code as per PR suggestions * Updated code as pr PR siggestions * Added custom search narrowing filter * Updated code to get claim name from environment * Added rule builder to filter resources * code refactor * Added oauth support for task resource * Added verification of clientId from token * Added hibernate physical_naming_strategy to use proper table names. * updated code to use url mapping from environment * Removed client id validation from oauth token * fixed indentation * Updated fork with upstream * Removed unwanted files * removed unwanted imports and files merged during rebase 6.1.0 * removed unwanted imports and files merged during rebase 6.1.0 * removed unwanted imports and files merged during rebase 6.1.0 * removed unwanted imports and files merged during rebase 6.1.0 * Updated application-custom.yaml * commented allow-bean-definition-overriding * Sync application-custom.yaml * commented unused hibernate settings Signed-off-by: dependabot[bot] Co-authored-by: Tadgh Co-authored-by: Michael Buckley Co-authored-by: jkv Co-authored-by: chgl Co-authored-by: ppalacin Co-authored-by: Ally Shaban Co-authored-by: Vadim Peretokin Co-authored-by: Jaison B Co-authored-by: Jaison B Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Patrick Werner Co-authored-by: Håkan MacLean Co-authored-by: Ken Stevens Co-authored-by: Joel Schneider (NMDP) Co-authored-by: craig mcclendon Co-authored-by: Craig McClendon Co-authored-by: dotasek Co-authored-by: dotasek Co-authored-by: michaelabuckley Co-authored-by: Alejandro Medina Co-authored-by: Alejandro Medina Co-authored-by: Dennis Verspuij <6680484+dennisverspuij@users.noreply.github.com> Co-authored-by: markiantorno Co-authored-by: Ibrohim Kholilul Islam Co-authored-by: Ibrohim Kholilul Islam Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> Co-authored-by: juan.marchionatto Co-authored-by: jmarchionatto <60409882+jmarchionatto@users.noreply.github.com> Co-authored-by: Shubham Parikh Co-authored-by: Hank Wallace Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: Tadgh Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> Co-authored-by: Shubham Parikh Co-authored-by: vpanhale * Updated docker file to use /user/app dir (#39) * PT-689 split url (#40) * PT-689 splitting the URL of datasource * PT-689 splitting the URL of datasource * PT-689 adding an easier ability to switch to another DB server * PT-689 standardizing variable names Co-authored-by: Vadim Dribinsky * Sync 6.2.2 (#41) * Bump dep version * Remove javamail and replace with simple-java-mail * WIP * Remove print * Remove bean override * Bump version * Add broken test * Update for new style of container bean * Bump for new version * Update to 5.6.0-PRE7_NIH-SNAPSHOT and activate advanced index * Disable default flyway processing * Add local_base_urls configuration to feed DaoConfig.setTreatBaseUrlsAsLocal() * Added OpenAPI / Swagger option * Upgraded to 5.6.0 Subscription tests fail ... * Bumped version of Spring Boot in order to fix same issue as https://github.com/Haulmont/jmix-security/issues/90 * Update application.yaml See https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/292 * documented use of Values.extraEnv * added options for specifying a PodDisruptionBudget * simplified chart release workflow the Ubuntu runner base image already includes Helm 3.7.0 * Support HTTPS * Use default application.yaml * registering ValueSetOperationProvider * Upgrade to 5.7.0-PRE4-SNAPSHOT for testing * Share elasticsearch configuration * Fixed compile issues * Fix misconfiguration modelConfig is part of DaoConfig and should not have a separate lifecycle. * Bump to 5.7.0-PRE8-SNAPSHOT * Typo fix in README * Add configuration flag to enable storing of resources in lucene index (#304) * Add configuration flag to enable storing of resources in lucene index * Fix build issue * Fix code review suggestions Co-authored-by: Jaison B * Add ES native aggregation builder for lastN * Revert "Add ES native aggregation builder for lastN" This reverts commit 5312f78b956d4ad4863580035972263586d616c3. * bump version * Update for 5.7.x changes * Fix h2 dialect, replace mail dep * Bump postgresql from 42.2.23 to 42.2.25 Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.23 to 42.2.25. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.23...REL42.2.25) --- updated-dependencies: - dependency-name: org.postgresql:postgresql dependency-type: direct:production ... Signed-off-by: dependabot[bot] * bump Hapi PRE version * Bump to Hapi 6.0-SNAPSHOT and register the ValueSet provider. * Version bump to 5.7.0 and a few other components now draw the version from parent * Update application.yaml Momentarily added `allow-circular-references: true` * bump to real version * Bump version * Remove search coord thread pool * Added instructions about removing Hibernate dialect To fix the problem raised in [this](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/318) issue. * Bump HAPI-FHIR version * Move to newlines * fix to work with latest hapi-fhir * Feature/update docker support (#319) * Updated docker image according to discussion on https://github.com/hapifhir/hapi-fhir-jpaserver-starter/pull/305 * Added doc * Added corrections according to comments * Update Dockerfile * Update build-images.yaml Updated to default to distroless * add dao_scheduling_enabled configuration property (#324) * added reindexProvider to Config (#326) * Update application.yaml * Update application.yaml Roll back - mistake from my side * Bump hapi-fhir version to 'PRE5' (#329) * Add actuator * Bump to PRE8 * disable springboot actuator endpoints other than 'health' for security reasons (#338) Co-authored-by: Craig McClendon * Bump to PRE9 * Update application.yaml (#345) * add support for ms sql server (#347) * Fix comments in Demo that lead to 404 (#348) Co-authored-by: dotasek * updated helm chart to use v5.7.0 and latest PostgreSQL sub-chart (#346) * Update application.yaml Reverted to sane defaults * Bump to PRE10 * Updated to HAPI FHIR version 5.7.2 (#349) * Revert accidental default activation of experimental lucene indexing * Add disclaimer for advanced_lucene_indexing added warning to advanced_lucene_indexing: false property * Bump to hapi PRE11 * Expose Prometheus metrics (#355) * Add: of-type modifier option in application.yaml (#363) Co-authored-by: Alejandro Medina * Fix applying supported_resource_types option with list that already includes SearchParameter (#365) * Bump pom and minimum java version * Bump ES version * hibernate search application properties updates. * make lastN test pass * Remove value set provider as it causes a boot failure without lucene * Fix reindex provider * Bump java version for test * Bump to pre-01 * fix build * Re-add valuesetoperation provider * Disable lucene by default * Re-add valueset operation provider * adding smoke test files * adding base documentation * wip * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * Update src/test/smoketest/SMOKE_TEST.md Co-authored-by: Ken Stevens * bumping to non-snapshot version (#377) * updated helm chart to use latest v6.0.1 version of the image (#382) * updated helm chart to use latest v6.0.1 version of the image * updated workflow to run against multiple k8s versions * add BinaryAccessProvider to BaseJpaRestfulServer * Update src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> * Applying fix from upstream for h2 Binaries This issue is already fixed upstream. Can be removed with next hapi version upgrade. https://github.com/hapifhir/hapi-fhir/pull/3676 * removed wrong and duplicated config entry `daoconfig_client_id_strategy`does not resolve and is a duplicate of `client_id_strategy` * Added OpenTelemetry Java Agent JAR to container image (#391) Closes #387 * changes to pom.xml to enable publishing * fixed directory of the .war in tomcat-based image * bulk data instrumentation included * bulk data instrumentation turned off by default * updated opentelemetry-java-instrumentation JAR to 1.16.0 * Better support for ARM java17 regular doesn't have ARM, java17-debian11 does * Updated Otel Java agent to 1.17.0 * Updated hapi-fhir to 6.1.0 * Minor Helm chart dependency updates and security improvements * Don't run maven CI on changes to the helm chart * updated helm chart to use version 6.1.0 of the image * added appProperties.getInline_resource_storage_below_size() (#420) * added appProperties.getInline_resource_storage_below_size() * indentations * Feat/restructuring (#422) * Did restructuring and made repo validation interceptor an optional bean instead as it makes it more clean * Moved construction of FHIR servlet into a bean for better reuse of others that would like to depend directly on this library * Disabled default validation enabled * Extract IG loading (#426) * added back lost config entry: allowed_bundle_types (#427) * added back lost config entry * disabled entry * Bump snakeyaml from 1.30 to 1.31 Bumps [snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 1.30 to 1.31. - [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-1.31..snakeyaml-1.30) --- updated-dependencies: - dependency-name: org.yaml:snakeyaml dependency-type: direct:production ... Signed-off-by: dependabot[bot] * fix: configuration of cors Refs: #430 * Proper close DB connection after dialect was resolved (#435) * removed duplicated and wrong subscription code (#440) * fixed SubscriptionDebugLogInterceptor adding logic * switch to postgres db (#444) * revering to H2 (#449) * Tracking Hapi 6.2-PRE releases (#408) * Tracking branch for 6.1 pre-releases. * Update to 6.1.0-PRE3-SNAPSHOT * Adjust for hapi-fhir namespace changes and version * Adjust version to include new hapi-fhir HSearch fast path feature * Bump hapi PRE * Update to PRE16 * Adjust configuration class name to HAPI-FHIR HSearch namespace consolidation. Add commented out sample properties for lucene and elastic. Move batch.job.enabled property under spring: prefix to have it considered. * Adjust enumeration renaming * Repoint FHIR 6.2.0-PRE1-SNAPSHOT * Add missing Bean to starter configuration * Update to hapi-fhir 6.2.0-PRE2-SNAPSHOT * Update application-integrationtest.yaml and rename it as application.yaml to make test configuration independent of prod. * Update to hapi-fhir 6.2.0-PRE5-SNAPSHOT * Update dep * Bump version fix failures * Remove dead import * Fix up * remove batch refs Co-authored-by: Michael Buckley Co-authored-by: michaelabuckley Co-authored-by: juan.marchionatto Co-authored-by: Tadgh * Added hibernate.dialect for Postgress to Readme (#451) * fixes for support of R4B / 6.2.0 (#455) * upping hapi version to 6.2.1 * Updated Helm chart to use image 6.2.1 and latest PostgreSQL (#458) * Bumped version (#462) * Added custom property file * SAP-1596 Updated custom property file to read values from env * SAP-1687 Updated code to allow metadata request for server healthcheck (#7) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated docker compose file with required env variables * SAP-1656 Added enabled parameter for webservlet to enable/disable webapp (#4) Co-authored-by: Shubham Parikh * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi properties with env ones * Start Release branch for 5.1.0 * Add property for multitenancy * Get test passing * Add repo * Bump to current release * Rework the JPA server class a bit * Updating Dockerfile to use context code instead of re-cloning the hapi-fhir-jpaserver-starter project. Still re-builds the base hapi libraries, though. * Adding .dockerignore file to improve the efficiency of docker builds * Added support for configurable client ID strategy * Bump mysql-connector-java from 8.0.11 to 8.0.16 Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.11 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.11...8.0.16) Signed-off-by: dependabot[bot] * Resolve some compile errors * Fix EMPI rules json * Have EmpiSettings actually return an EmpiSettings bean * Update readme * Remove dead space * Update property * Update README to include Docker info * Prepare for release * Merge master * Removing commands from Dockerfile that clone and build the core hapi-fhir libraries since it is not required for building hapi-fhir-jpaserver-starter; it pulls the core libraries from the maven repo regardless. * Combining base Dockerfile with main dockerfile so that there is a single image related to hapi-jpaserver-starter * Update Dockerfile Added caching of maven dependency resolving * Fix #122 - EMPI error on startup when EMPI not enabled Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: jamesagnew Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tadgh Co-authored-by: Tadgh Co-authored-by: Ken Stevens Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> * Updated code to read url pattern from environment. (#10) * BT-96 Added OAuth support * BT-96 Fixed indentation * BT-96 Fixed spacing * BT-96 Removed unwanted filed * Changes in code as per PR suggestions * added rest security extension in metadata * Updated PR as per suggestions * Updated README.md file to run the app with custom property file & env variables * Updated PR as per suggestions * Added user role validation in Oauth * code refactor * Updated code for using single oauth user role * Updated code as per PR suggestions * Updated code as pr PR siggestions * Added suppoet of delete operation to admin only * Refactored code * Added custom search narrowing filter * Updated code to work with oauth disabled * Updated code to get claim name from environment * change claim name env varible to proper name * Updated code to use hard-coded claim name * Changed custom mapper claim name to patient from subject * Added rule builder to filter resources * code refactor * Update CustomAuthorizationInterceptor.java * updated code to support operations on bundle resources * Added consent rule to allow patch request * Added oauth support for task resource * Updated code to make refrence check generic method * Updated method names * Updated code as per PR suggestions * Update code as per PR suggestion * Updated code as per PR * Added verification of clientId from token * Added basic authentication * Code refactor * Added username/password check while checking is basic auth enabled * DEV-769: Update from upstream branch (#9) * Adding environment variables to override hapi properties file settings * Only override existing hapi pro… * removed duplicate variable --------- Signed-off-by: dependabot[bot] Co-authored-by: Ally Shaban Co-authored-by: Michael Buckley Co-authored-by: Jens Kristian Villadsen Co-authored-by: Vadim Peretokin Co-authored-by: Jaison B Co-authored-by: Jaison B Co-authored-by: Tadgh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Patrick Werner Co-authored-by: Håkan MacLean Co-authored-by: Ken Stevens Co-authored-by: Joel Schneider (NMDP) Co-authored-by: craig mcclendon Co-authored-by: Craig McClendon Co-authored-by: dotasek Co-authored-by: dotasek Co-authored-by: chgl Co-authored-by: michaelabuckley Co-authored-by: Alejandro Medina Co-authored-by: Alejandro Medina Co-authored-by: Dennis Verspuij <6680484+dennisverspuij@users.noreply.github.com> Co-authored-by: markiantorno Co-authored-by: Ibrohim Kholilul Islam Co-authored-by: Ibrohim Kholilul Islam Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> Co-authored-by: Arbaaz Muslim Co-authored-by: Thomas Papke Co-authored-by: rti Co-authored-by: jmarchionatto <60409882+jmarchionatto@users.noreply.github.com> Co-authored-by: juan.marchionatto Co-authored-by: Kai-W Co-authored-by: James Agnew Co-authored-by: Luke deGruchy Co-authored-by: isims Co-authored-by: Panayiotis Savva Co-authored-by: Juvar Abrera Co-authored-by: Hank Wallace Co-authored-by: Shubham Parikh Co-authored-by: Peter Micuch Co-authored-by: Vladimir Nemergut Co-authored-by: Sean McIlvenna Co-authored-by: jvi Co-authored-by: Sean McIlvenna Co-authored-by: Tadgh Co-authored-by: Jens Kristian Villadsen <46567685+jvitrifork@users.noreply.github.com> Co-authored-by: Shubham Parikh Co-authored-by: vpanhale Co-authored-by: ppalacin Co-authored-by: Vadim Dribinsky Co-authored-by: Vadim Dribinsky --- .github/workflows/maven.yml | 2 +- .vscode/settings.json | 8 --- README.md | 68 ++++++++----------- charts/hapi-fhir-jpaserver/Chart.yaml | 12 ++-- charts/hapi-fhir-jpaserver/README.md | 4 +- .../templates/tests/test-endpoints.yaml | 6 +- charts/hapi-fhir-jpaserver/values.yaml | 2 +- pom.xml | 35 ++++++++-- .../uhn/fhir/jpa/starter/AppProperties.java | 39 +++++++++-- .../ca/uhn/fhir/jpa/starter/Application.java | 6 +- .../starter/ExtraStaticFilesConfigurer.java | 40 +++++++++++ .../ca/uhn/fhir/jpa/starter/OAuth2Helper.java | 2 +- .../starter/common/FhirServerConfigDstu2.java | 6 -- .../starter/common/FhirServerConfigDstu3.java | 4 +- .../starter/common/FhirServerConfigR4.java | 9 ++- .../jpa/starter/common/StarterJpaConfig.java | 66 ++++++++++++++---- .../jpa/starter/cql/StarterCqlR4Config.java | 11 --- .../CrConfigCondition.java} | 6 +- .../StarterCrDstu3Config.java} | 10 +-- .../jpa/starter/cr/StarterCrR4Config.java | 11 +++ .../jpa/starter/ips/IpsConfigCondition.java | 14 ++++ .../jpa/starter/ips/StarterIpsConfig.java | 34 ++++++++++ src/main/resources/application.yaml | 18 ++++- .../uhn/fhir/jpa/starter/CustomBeanTest.java | 24 +++++++ .../jpa/starter/CustomInterceptorTest.java | 64 +++++++++++++++++ .../jpa/starter/ElasticsearchLastNR4IT.java | 4 +- .../jpa/starter/ExampleServerDstu2IT.java | 2 +- .../jpa/starter/ExampleServerDstu3IT.java | 13 ++-- .../fhir/jpa/starter/ExampleServerR4BIT.java | 4 +- .../fhir/jpa/starter/ExampleServerR4IT.java | 4 +- .../fhir/jpa/starter/ExampleServerR5IT.java | 2 +- .../JpaStarterWebsocketDispatcherConfig.java | 34 ++++++++++ .../jpa/starter/MultitenantServerR4IT.java | 3 +- .../java/some/custom/pkg1/CustomBean.java | 18 +++++ .../custom/pkg1/CustomInterceptorBean.java | 31 +++++++++ .../custom/pkg1/CustomInterceptorPojo.java | 26 +++++++ src/test/resources/application.yaml | 2 +- 37 files changed, 505 insertions(+), 139 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 src/main/java/ca/uhn/fhir/jpa/starter/ExtraStaticFilesConfigurer.java delete mode 100644 src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlR4Config.java rename src/main/java/ca/uhn/fhir/jpa/starter/{cql/CqlConfigCondition.java => cr/CrConfigCondition.java} (77%) rename src/main/java/ca/uhn/fhir/jpa/starter/{cql/StarterCqlDstu3Config.java => cr/StarterCrDstu3Config.java} (53%) create mode 100644 src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java create mode 100644 src/main/java/ca/uhn/fhir/jpa/starter/ips/IpsConfigCondition.java create mode 100644 src/main/java/ca/uhn/fhir/jpa/starter/ips/StarterIpsConfig.java create mode 100644 src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java create mode 100644 src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java create mode 100644 src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java create mode 100644 src/test/java/some/custom/pkg1/CustomBean.java create mode 100644 src/test/java/some/custom/pkg1/CustomInterceptorBean.java create mode 100644 src/test/java/some/custom/pkg1/CustomInterceptorPojo.java diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7fc93b8be73..405c48a6001 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,4 +26,4 @@ jobs: with: java-version: 17 - name: Build with Maven - run: mvn -B package --file pom.xml + run: mvn -B package --file pom.xml verify diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 2421e386c30..00000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files.exclude": { - "**/.classpath": true, - "**/.project": true, - "**/.settings": true, - "**/.factorypath": true - } -} \ No newline at end of file diff --git a/README.md b/README.md index 487ad5789d6..53c59d75271 100644 --- a/README.md +++ b/README.md @@ -201,35 +201,11 @@ hapi-fhir/hapi-fhir-jpaserver-starter:latest Much of this HAPI starter project can be configured using the yaml file in _src/main/resources/application.yaml_. By default, this starter project is configured to use H2 as the database. -### MySql configuration +### MySQL configuration -To configure the starter app to use MySQL, instead of the default H2, update the application.yaml file to have the following: +HAPI FHIR JPA Server does not support MySQL as it is deprecated. -```yaml -spring: - datasource: - url: 'jdbc:mysql://localhost:3306/hapi_dstu3' - username: admin - password: admin - driverClassName: com.mysql.jdbc.Driver -``` - -Also, make sure you are not setting the Hibernate dialect explicitly, in other words remove any lines similar to: - -``` -hibernate.dialect: {some none MySQL dialect} -``` - -On some systems, it might be necessary to override hibernate's default naming strategy. The naming strategy must be set using spring.jpa.hibernate.physical_naming_strategy. - -```yaml -spring: - jpa: - hibernate.physical_naming_strategy: NAME_OF_PREFERRED_STRATEGY -``` -On linux systems or when using docker mysql containers, it will be necessary to review the case-sensitive setup for -mysql schema identifiers. See https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html. We suggest you -set `lower_case_table_names=1` during mysql startup. +See more at https://hapifhir.io/hapi-fhir/docs/server_jpa/database_support.html ### PostgreSQL configuration @@ -238,13 +214,16 @@ To configure the starter app to use PostgreSQL, instead of the default H2, updat ```yaml spring: datasource: - url: 'jdbc:postgresql://localhost:5432/hapi_dstu3' + url: 'jdbc:postgresql://localhost:5432/hapi' username: admin password: admin driverClassName: org.postgresql.Driver jpa: properties: hibernate.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect + hibernate.search.enabled: false + + # Then comment all hibernate.search.backend.* ``` Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured PostgreSQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. @@ -275,6 +254,16 @@ Because the integration tests within the project rely on the default H2 database NOTE: MS SQL Server by default uses a case-insensitive codepage. This will cause errors with some operations - such as when expanding case-sensitive valuesets (UCUM) as there are unique indexes defined on the terminology tables for codes. It is recommended to deploy a case-sensitive database prior to running HAPI FHIR when using MS SQL Server to avoid these and potentially other issues. +## Adding custom interceptors +Custom interceptors can be registered with the server by including the property `hapi.fhir.custom-interceptor-classes`. This will take a comma separated list of fully-qualified class names which will be registered with the server. +Interceptors will be discovered in one of two ways: + +1) discovered from the Spring application context as existing Beans (can be used in conjunction with `hapi.fhir.custom-bean-packages`) or registered with Spring via other methods + +or + +2) classes will be instantiated via reflection if no matching Bean is found + ## Customizing The Web Testpage UI The UI that comes with this server is an exact clone of the server available at [http://hapi.fhir.org](http://hapi.fhir.org). You may skin this UI if you'd like. For example, you might change the introductory text or replace the logo with your own. @@ -327,19 +316,23 @@ reached at http://localhost:8080/. In order to use another port, change the `ports` parameter inside `docker-compose.yml` to `8888:8080`, where 8888 is a port of your choice. -The docker compose set also includes my MySQL database, if you choose to use MySQL instead of H2, change the following -properties in application.yaml: +The docker compose set also includes PostgreSQL database, if you choose to use PostgreSQL instead of H2, change the following +properties in `src/main/resources/application.yaml`: ```yaml spring: datasource: - url: 'jdbc:mysql://hapi-fhir-mysql:3306/hapi' + url: 'jdbc:postgresql://hapi-fhir-postgres:5432/hapi' username: admin password: admin - driverClassName: com.mysql.jdbc.Driver -``` + driverClassName: org.postgresql.Driver +jpa: + properties: + hibernate.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect + hibernate.search.enabled: false -Also, make sure you are not setting the Hibernate Dialect explicitly, see more details in the section about MySQL. + # Then comment all hibernate.search.backend.* +``` ## Running hapi-fhir-jpaserver directly from IntelliJ as Spring Boot Make sure you run with the maven profile called ```boot``` and NOT also ```jetty```. Then you are ready to press debug the project directly without any extra Application Servers. @@ -376,8 +369,6 @@ Run the configuration. Point your browser (or fiddler, or what have you) to `http://localhost:8080/hapi/baseDstu3/Patient` -It is important to use MySQL5Dialect when using MySQL version 5+. - ## Enabling Subscriptions The server may be configured with subscription support by enabling properties in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file: @@ -388,9 +379,9 @@ The server may be configured with subscription support by enabling properties in - `hapi.fhir.subscription.websocket_enabled` - Enables websocket subscriptions. With this enabled, your server will accept incoming websocket connections on the following URL (this example uses the default context path and port, you may need to tweak depending on your deployment environment): [ws://localhost:8080/websocket](ws://localhost:8080/websocket) -## Enabling CQL +## Enabling Clinical Reasoning -Set `hapi.fhir.cql_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable [Clinical Quality Language](https://cql.hl7.org/) on this server. +Set `hapi.fhir.cr_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable [Clinical Quality Language](https://cql.hl7.org/) on this server. ## Enabling MDM (EMPI) @@ -459,4 +450,3 @@ docker run --rm -it -p 8080:8080 \ ``` You can configure the agent using environment variables or Java system properties, see for details. - diff --git a/charts/hapi-fhir-jpaserver/Chart.yaml b/charts/hapi-fhir-jpaserver/Chart.yaml index 736c5d5e577..91580077790 100644 --- a/charts/hapi-fhir-jpaserver/Chart.yaml +++ b/charts/hapi-fhir-jpaserver/Chart.yaml @@ -10,18 +10,14 @@ dependencies: version: 12.1.2 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled -appVersion: 6.2.1 -version: 0.11.0 +appVersion: 6.2.2 +version: 0.11.1 annotations: artifacthub.io/license: Apache-2.0 artifacthub.io/changes: | # When using the list of objects option the valid supported kinds are # added, changed, deprecated, removed, fixed, and security. - kind: changed - description: updated HAPI FHIR JPA Server app image version to v6.2.1 + description: updated HAPI FHIR JPA Server app image version to v6.2.2 - kind: changed - description: | - Reduced `startupProbe.initialDelaySeconds` to a more realistic `30` from `60`. - This should allow the server to become ready quicker and recover from failures faster. - - kind: changed - description: "⚠️ BREAKING CHANGE: updated included postgresql chart to v12, which is based on PostgreSQL 15.1" + description: updated curl used by helm tests to version to v7.87.0 diff --git a/charts/hapi-fhir-jpaserver/README.md b/charts/hapi-fhir-jpaserver/README.md index 5ab71f70228..8b4b4619d43 100644 --- a/charts/hapi-fhir-jpaserver/README.md +++ b/charts/hapi-fhir-jpaserver/README.md @@ -1,6 +1,6 @@ # HAPI FHIR JPA Server Starter Helm Chart -![Version: 0.11.0](https://img.shields.io/badge/Version-0.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.2.1](https://img.shields.io/badge/AppVersion-6.2.1-informational?style=flat-square) +![Version: 0.11.1](https://img.shields.io/badge/Version-0.11.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.2.2](https://img.shields.io/badge/AppVersion-6.2.2-informational?style=flat-square) This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes environment. @@ -32,7 +32,7 @@ helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpas | image.pullPolicy | string | `"IfNotPresent"` | image pullPolicy to use | | image.registry | string | `"docker.io"` | registry where the HAPI FHIR server image is hosted | | image.repository | string | `"hapiproject/hapi"` | the path inside the repository | -| image.tag | string | `"v6.2.1@sha256:8d1b4c1c8abd613f685267a3dda494d87aba4cff449eed39902a6ece2c086f3c"` | the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image. | +| image.tag | string | `"v6.2.2@sha256:9c4e8af94d81ac0049dbb589e4cd855bf78c9c13be6f6844e814c63d63545b44"` | the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image. | | imagePullSecrets | list | `[]` | image pull secrets to use when pulling the image | | ingress.annotations | object | `{}` | provide any additional annotations which may be required. Evaluated as a template. | | ingress.enabled | bool | `false` | whether to create an Ingress to expose the FHIR server HTTP endpoint | diff --git a/charts/hapi-fhir-jpaserver/templates/tests/test-endpoints.yaml b/charts/hapi-fhir-jpaserver/templates/tests/test-endpoints.yaml index bf99dbce369..034efb12e02 100644 --- a/charts/hapi-fhir-jpaserver/templates/tests/test-endpoints.yaml +++ b/charts/hapi-fhir-jpaserver/templates/tests/test-endpoints.yaml @@ -11,7 +11,7 @@ spec: restartPolicy: Never containers: - name: test-metadata-endpoint - image: docker.io/curlimages/curl:7.86.0@sha256:cfdeba7f88bb85f6c87f2ec9135115b523a1c24943976a61fbf59c4f2eafd78e + image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd command: ["curl", "--fail-with-body"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/metadata?_summary=true"] {{- with .Values.restrictedContainerSecurityContext }} @@ -32,7 +32,7 @@ spec: exec: command: ["true"] - name: test-patient-endpoint - image: docker.io/curlimages/curl:7.86.0@sha256:cfdeba7f88bb85f6c87f2ec9135115b523a1c24943976a61fbf59c4f2eafd78e + image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd command: ["curl", "--fail-with-body"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/Patient?_count=1&_summary=true"] {{- with .Values.restrictedContainerSecurityContext }} @@ -53,7 +53,7 @@ spec: exec: command: ["true"] - name: test-metrics-endpoint - image: docker.io/curlimages/curl:7.86.0@sha256:cfdeba7f88bb85f6c87f2ec9135115b523a1c24943976a61fbf59c4f2eafd78e + image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd command: ["curl", "--fail-with-body"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.metrics.service.port }}/actuator/prometheus"] {{- with .Values.restrictedContainerSecurityContext }} diff --git a/charts/hapi-fhir-jpaserver/values.yaml b/charts/hapi-fhir-jpaserver/values.yaml index b55d4ea7ea0..be02b18983b 100644 --- a/charts/hapi-fhir-jpaserver/values.yaml +++ b/charts/hapi-fhir-jpaserver/values.yaml @@ -7,7 +7,7 @@ image: # -- the path inside the repository repository: hapiproject/hapi # -- the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image. - tag: "v6.2.1@sha256:8d1b4c1c8abd613f685267a3dda494d87aba4cff449eed39902a6ece2c086f3c" + tag: "v6.2.2@sha256:9c4e8af94d81ac0049dbb589e4cd855bf78c9c13be6f6844e814c63d63545b44" # -- image pullPolicy to use pullPolicy: IfNotPresent diff --git a/pom.xml b/pom.xml index ae5e6bb42b4..576b6fa3adc 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.5 + 6.4.0 hapi-fhir-jpaserver-starter @@ -22,6 +22,8 @@ 11 + 1.2.11 + 1.7.25 @@ -43,12 +45,12 @@ org.eclipse.jetty.websocket - websocket-api + websocket-jetty-api ${jetty_version} org.eclipse.jetty.websocket - websocket-client + websocket-jetty-client ${jetty_version} @@ -131,7 +133,7 @@ ca.uhn.hapi.fhir - hapi-fhir-jpaserver-cql + hapi-fhir-storage-cr ${project.version} @@ -160,6 +162,12 @@ ${project.version} classes + + + ca.uhn.hapi.fhir + hapi-fhir-jpaserver-ips + ${project.version} + @@ -262,7 +270,7 @@ org.eclipse.jetty.websocket - websocket-server + websocket-jetty-server test @@ -373,6 +381,23 @@ test + + org.slf4j + slf4j-api + ${slf4j-api.version} + + + + ch.qos.logback + logback-classic + ${logback-classic.version} + + + ch.qos.logback + logback-core + ${logback-classic.version} + + diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index 332c1794942..ba3d1493ccf 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -21,7 +21,8 @@ @EnableConfigurationProperties public class AppProperties { - private Boolean cql_enabled = false; + private Boolean cr_enabled = false; + private Boolean ips_enabled = false; private Boolean openapi_enabled = false; private Boolean mdm_enabled = false; private boolean advanced_lucene_indexing = false; @@ -72,6 +73,8 @@ public class AppProperties { private Boolean install_transitive_ig_dependencies = true; private Map implementationGuides = null; + private String staticLocation = null; + private Boolean lastn_enabled = false; private boolean store_resource_in_lucene_index_enabled = false; private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED; @@ -82,9 +85,26 @@ public class AppProperties { private Integer bundle_batch_pool_size = 20; private Integer bundle_batch_pool_max_size = 100; private final List local_base_urls = new ArrayList<>(); + + private final List custom_interceptor_classes = new ArrayList<>(); + + public List getCustomInterceptorClasses() { + return custom_interceptor_classes; + } + + + public String getStaticLocation() { + return staticLocation; + } + + public void setStaticLocation(String staticLocation) { + this.staticLocation = staticLocation; + } + private Oauth oauth = new Oauth(); + public Boolean getOpenapi_enabled() { return openapi_enabled; } @@ -133,14 +153,23 @@ public void setPartitioning(Partitioning partitioning) { this.partitioning = partitioning; } - public Boolean getCql_enabled() { - return cql_enabled; + public Boolean getCr_enabled() { + return cr_enabled; } - public void setCql_enabled(Boolean cql_enabled) { - this.cql_enabled = cql_enabled; + public void setCr_enabled(Boolean cr_enabled) { + this.cr_enabled = cr_enabled; } + public Boolean getIps_enabled() { + return ips_enabled; + } + + public void setIps_enabled(Boolean ips_enabled) { + this.ips_enabled = ips_enabled; + } + + public Boolean getMdm_enabled() { return mdm_enabled; } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index 3b4e851a2f6..6b223f57b2d 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -15,6 +15,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; +import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletRegistrationBean; @@ -22,11 +23,12 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Import; +import org.springframework.util.ObjectUtils; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; @ServletComponentScan(basePackageClasses = {RestfulServer.class}) -@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class}) +@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class, ThymeleafAutoConfiguration.class}) @Import({ SubscriptionSubmitterConfig.class, SubscriptionProcessorConfig.class, @@ -58,7 +60,7 @@ protected SpringApplicationBuilder configure( @Bean @Conditional(OnEitherVersion.class) public ServletRegistrationBean hapiServletRegistration(RestfulServer restfulServer) { - String urlMapping = System.getenv("url_pattern"); + String urlMapping = ObjectUtils.isEmpty(System.getenv("url_pattern")) ? "/fhir/*" : System.getenv("url_pattern"); ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(); beanFactory.autowireBean(restfulServer); servletRegistrationBean.setServlet(restfulServer); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ExtraStaticFilesConfigurer.java b/src/main/java/ca/uhn/fhir/jpa/starter/ExtraStaticFilesConfigurer.java new file mode 100644 index 00000000000..d875ec6a5d6 --- /dev/null +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ExtraStaticFilesConfigurer.java @@ -0,0 +1,40 @@ +package ca.uhn.fhir.jpa.starter; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.net.URI; + +@Configuration +@ConditionalOnProperty(prefix = "hapi.fhir", name = "staticLocation") +public class ExtraStaticFilesConfigurer implements WebMvcConfigurer { + + public static final String ROOT_CONTEXT_PATH = "/static"; + @Autowired + AppProperties appProperties; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry theRegistry) { + theRegistry.addResourceHandler(ROOT_CONTEXT_PATH + "/**").addResourceLocations(appProperties.getStaticLocation()); + } + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + String path = URI.create(appProperties.getStaticLocation()).getPath(); + String lastSegment = path.substring(path.lastIndexOf('/') + 1); + + registry.addViewController(ROOT_CONTEXT_PATH).setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); + + registry.addViewController(ROOT_CONTEXT_PATH + "/*").setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); + + registry.addViewController(ROOT_CONTEXT_PATH + "/" + lastSegment + "/").setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); + + registry.setOrder(Ordered.HIGHEST_PRECEDENCE); + } + +} \ No newline at end of file diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/OAuth2Helper.java b/src/main/java/ca/uhn/fhir/jpa/starter/OAuth2Helper.java index f4ec36cb41c..129bacde55c 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/OAuth2Helper.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/OAuth2Helper.java @@ -149,4 +149,4 @@ public boolean isOAuthHeaderPresent(RequestDetails theRequest) { String token = theRequest.getHeader(HttpHeaders.AUTHORIZATION); return (!ObjectUtils.isEmpty(token) && token.toUpperCase().contains(CustomAuthorizationInterceptor.getTokenPrefix())); } -} +} \ No newline at end of file diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu2.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu2.java index baf5044ce12..9416d2835e0 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu2.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu2.java @@ -2,7 +2,6 @@ import ca.uhn.fhir.jpa.config.JpaDstu2Config; import ca.uhn.fhir.jpa.starter.annotations.OnDSTU2Condition; -import ca.uhn.fhir.jpa.term.TermCodeSystemStorageSvcImpl; import ca.uhn.fhir.jpa.term.TermLoaderSvcImpl; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; @@ -24,9 +23,4 @@ public ITermLoaderSvc termLoaderService(ITermDeferredStorageSvc theDeferredStora return new TermLoaderSvcImpl(theDeferredStorageSvc, theCodeSystemStorageSvc); } - @Bean - public ITermCodeSystemStorageSvc termCodeSystemStorageSvc() { - return new TermCodeSystemStorageSvcImpl(); - } - } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu3.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu3.java index 0e0c76358d1..085764d1bd6 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu3.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigDstu3.java @@ -2,7 +2,7 @@ import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config; import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition; -import ca.uhn.fhir.jpa.starter.cql.StarterCqlDstu3Config; +import ca.uhn.fhir.jpa.starter.cr.StarterCrDstu3Config; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -12,7 +12,7 @@ @Import({ JpaDstu3Config.class, StarterJpaConfig.class, - StarterCqlDstu3Config.class, + StarterCrDstu3Config.class, ElasticsearchConfig.class}) public class FhirServerConfigDstu3 { } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigR4.java index 6ee7a990846..61dbab53a9a 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigR4.java @@ -2,7 +2,9 @@ import ca.uhn.fhir.jpa.config.r4.JpaR4Config; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; -import ca.uhn.fhir.jpa.starter.cql.StarterCqlR4Config; +import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config; +import ca.uhn.fhir.jpa.starter.ips.StarterIpsConfig; + import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -12,8 +14,9 @@ @Import({ JpaR4Config.class, StarterJpaConfig.class, - StarterCqlR4Config.class, - ElasticsearchConfig.class + StarterCrR4Config.class, + ElasticsearchConfig.class, + StarterIpsConfig.class }) public class FhirServerConfigR4 { } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java index e630772ea18..eb5885fd11b 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java @@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.graphql.GraphQLProvider; import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor; import ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingInterceptor; +import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider; import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.jpa.partition.PartitionManagementProvider; @@ -68,9 +69,11 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.*; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.http.HttpHeaders; @@ -85,12 +88,12 @@ import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR; @Configuration +//allow users to configure custom packages to scan for additional beans +@ComponentScan(basePackages = { "${hapi.fhir.custom-bean-packages:}" }) @Import( - ThreadPoolFactoryConfig.class + ThreadPoolFactoryConfig.class ) public class StarterJpaConfig { - private static final String FHIR_VERSION = System.getenv("fhir_version"); - private static final String OAUTH_ENABLED = System.getenv("OAUTH_ENABLED"); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StarterJpaConfig.class); @@ -208,16 +211,6 @@ public IPackageInstallerSvc packageInstaller(AppProperties appProperties, JobDef return packageInstallerSvc; } - @Bean - @Primary - /* - This bean is currently necessary to override from MDM settings - */ - IMdmLinkDao mdmLinkDao() { - return new MdmLinkDaoJpaImpl(); - } - - @Bean @Conditional(OnCorsPresent.class) public CorsInterceptor corsInterceptor(AppProperties appProperties) { @@ -250,7 +243,7 @@ public CorsInterceptor corsInterceptor(AppProperties appProperties) { } @Bean - public RestfulServer restfulServer(IFhirSystemDao fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional terminologyUploaderProvider, Optional subscriptionTriggeringProvider, Optional corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc) { + public RestfulServer restfulServer(IFhirSystemDao fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional terminologyUploaderProvider, Optional subscriptionTriggeringProvider, Optional corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, Optional theIpsOperationProvider) { RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext()); List supportedResourceTypes = appProperties.getSupported_resource_types(); @@ -426,11 +419,56 @@ public RestfulServer restfulServer(IFhirSystemDao fhirSystemDao, AppProper repositoryValidatingInterceptor.ifPresent(fhirServer::registerInterceptor); + // register custom interceptors + registerCustomInterceptors(fhirServer, appContext, appProperties.getCustomInterceptorClasses()); + //register the IPS Provider + if (!theIpsOperationProvider.isEmpty()) { + fhirServer.registerProvider(theIpsOperationProvider.get()); + } + return fhirServer; } + /** + * check the properties for custom interceptor classes and registers them. + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void registerCustomInterceptors(RestfulServer fhirServer, ApplicationContext theAppContext, List customInterceptorClasses) { + + if (customInterceptorClasses == null) { + return; + } + + for (String className : customInterceptorClasses) { + Class clazz; + try { + clazz = Class.forName(className); + } catch (ClassNotFoundException e) { + throw new ConfigurationException("Interceptor class was not found on classpath: " + className, e); + } + + // first check if the class a Bean in the app context + Object interceptor = null; + try { + interceptor = theAppContext.getBean(clazz); + } catch (NoSuchBeanDefinitionException ex) { + // no op - if it's not a bean we'll try to create it + } + + // if not a bean, instantiate the interceptor via reflection + if (interceptor == null) { + try { + interceptor = clazz.getConstructor().newInstance(); + } catch (Exception e) { + throw new ConfigurationException("Unable to instantiate interceptor class : " + className, e); + } + } + fhirServer.registerInterceptor(interceptor); + } + } + public static IServerConformanceProvider calculateConformanceProvider(IFhirSystemDao fhirSystemDao, RestfulServer fhirServer, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport) { FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion(); if (fhirVersion == FhirVersionEnum.DSTU2) { diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlR4Config.java deleted file mode 100644 index ff9bf169b20..00000000000 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlR4Config.java +++ /dev/null @@ -1,11 +0,0 @@ -package ca.uhn.fhir.jpa.starter.cql; - -import ca.uhn.fhir.cql.config.CqlR4Config; -import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Import; - -@Conditional({OnR4Condition.class, CqlConfigCondition.class}) -@Import({CqlR4Config.class}) -public class StarterCqlR4Config { -} diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cql/CqlConfigCondition.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrConfigCondition.java similarity index 77% rename from src/main/java/ca/uhn/fhir/jpa/starter/cql/CqlConfigCondition.java rename to src/main/java/ca/uhn/fhir/jpa/starter/cr/CrConfigCondition.java index 38622ba9d89..b488bcfe1fa 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cql/CqlConfigCondition.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrConfigCondition.java @@ -1,14 +1,14 @@ -package ca.uhn.fhir.jpa.starter.cql; +package ca.uhn.fhir.jpa.starter.cr; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; -public class CqlConfigCondition implements Condition { +public class CrConfigCondition implements Condition { @Override public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) { - String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cql_enabled"); + String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cr_enabled"); return Boolean.parseBoolean(property); } } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlDstu3Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java similarity index 53% rename from src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlDstu3Config.java rename to src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java index 5753dce2f8a..9efc08645b9 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cql/StarterCqlDstu3Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java @@ -1,13 +1,13 @@ -package ca.uhn.fhir.jpa.starter.cql; +package ca.uhn.fhir.jpa.starter.cr; -import ca.uhn.fhir.cql.config.CqlDstu3Config; +import ca.uhn.fhir.cr.config.CrDstu3Config; import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration -@Conditional({OnDSTU3Condition.class, CqlConfigCondition.class}) -@Import({CqlDstu3Config.class}) -public class StarterCqlDstu3Config { +@Conditional({OnDSTU3Condition.class, CrConfigCondition.class}) +@Import({CrDstu3Config.class}) +public class StarterCrDstu3Config { } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java new file mode 100644 index 00000000000..a97cea7835f --- /dev/null +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java @@ -0,0 +1,11 @@ +package ca.uhn.fhir.jpa.starter.cr; + +import ca.uhn.fhir.cr.config.CrR4Config; +import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Import; + +@Conditional({OnR4Condition.class, CrConfigCondition.class}) +@Import({CrR4Config.class}) +public class StarterCrR4Config { +} diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ips/IpsConfigCondition.java b/src/main/java/ca/uhn/fhir/jpa/starter/ips/IpsConfigCondition.java new file mode 100644 index 00000000000..973491a1f3f --- /dev/null +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ips/IpsConfigCondition.java @@ -0,0 +1,14 @@ +package ca.uhn.fhir.jpa.starter.ips; + +import org.springframework.context.annotation.Condition; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.core.type.AnnotatedTypeMetadata; + +public class IpsConfigCondition implements Condition { + + @Override + public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) { + String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.ips_enabled"); + return Boolean.parseBoolean(property); + } +} diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ips/StarterIpsConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/ips/StarterIpsConfig.java new file mode 100644 index 00000000000..e777879a580 --- /dev/null +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ips/StarterIpsConfig.java @@ -0,0 +1,34 @@ +package ca.uhn.fhir.jpa.starter.ips; + +import org.springframework.context.annotation.Bean; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.api.dao.DaoRegistry; +import ca.uhn.fhir.jpa.ips.api.IIpsGenerationStrategy; +import ca.uhn.fhir.jpa.ips.strategy.DefaultIpsGenerationStrategy; +import ca.uhn.fhir.jpa.ips.generator.IIpsGeneratorSvc; +import org.springframework.context.annotation.Conditional; +import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider; +import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl; + + +@Conditional(IpsConfigCondition.class) +public class StarterIpsConfig { + @Bean + IIpsGenerationStrategy IpsGenerationStrategy() + { + return new DefaultIpsGenerationStrategy(); + } + + @Bean + public IpsOperationProvider IpsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){ + return new IpsOperationProvider(theIpsGeneratorSvc); + } + + @Bean + public IIpsGeneratorSvc IpsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry) + { + return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry); + } + +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 67a652fdbc8..31d6f9626e6 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -28,10 +28,10 @@ spring: properties: hibernate.format_sql: false hibernate.show_sql: false + #Hibernate dialect is automatically detected except Postgres and H2. #If using H2, then supply the value of ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect #If using postgres, then supply the value of ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect - hibernate.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect # hibernate.hbm2ddl.auto: update # hibernate.jdbc.batch_size: 20 @@ -62,6 +62,9 @@ hapi: ### forces the use of the https:// protocol for the returned server address. ### alternatively, it may be set using the X-Forwarded-Proto header. # use_apache_address_strategy_https: false + ### enables the server to host content like HTML, css, etc. under the url pattern of /static/** + ### the deepest folder level will be used. E.g. - if you put file:/foo/bar/bazz as value then the files are resolved under /static/bazz/** + #staticLocation: file:/foo/bar/bazz ### enable to set the Server URL # server_address: http://hapi.fhir.org/baseR4 # defer_indexing_for_codesystems_of_size: 101 @@ -89,7 +92,8 @@ hapi: # allow_multiple_delete: true # allow_override_default_search_params: true # auto_create_placeholder_reference_targets: false - # cql_enabled: true + # cr_enabled: true + # ips_enabled: false # default_encoding: JSON # default_pretty_print: true # default_page_size: 20 @@ -113,7 +117,7 @@ hapi: # fhirpath_interceptor_enabled: false # filter_search_enabled: true # graphql_enabled: true - # narrative_enabled: true + narrative_enabled: false # mdm_enabled: true # local_base_urls: # - https://hapi.fhir.org/baseR4 @@ -131,6 +135,14 @@ hapi: search-coord-core-pool-size: 20 search-coord-max-pool-size: 100 search-coord-queue-capacity: 200 + + # comma-separated package names, will be @ComponentScan'ed by Spring to allow for creating custom Spring beans + #custom-bean-packages: + + # comma-separated list of fully qualified interceptor classes. + # classes listed here will be fetched from the Spring context when combined with 'custom-bean-packages', + # or will be instantiated via reflection using an no-arg contructor; then registered with the server + #custom-interceptor-classes: # Threadpool size for BATCH'ed GETs in a bundle. # bundle_batch_pool_size: 10 diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java new file mode 100644 index 00000000000..07e7f581a30 --- /dev/null +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java @@ -0,0 +1,24 @@ +package ca.uhn.fhir.jpa.starter; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { + "hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2", + "spring.datasource.url=jdbc:h2:mem:dbr4", + // "hapi.fhir.enable_repository_validating_interceptor=true", + "hapi.fhir.fhir_version=r4" +}) +public class CustomBeanTest { + + @Autowired + some.custom.pkg1.CustomBean customBean1; + + @Test + void testCustomBeanExists() { + Assertions.assertNotNull(customBean1); + Assertions.assertEquals("I am alive", customBean1.getInitFlag()); + } +} diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java new file mode 100644 index 00000000000..367857b7009 --- /dev/null +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java @@ -0,0 +1,64 @@ +package ca.uhn.fhir.jpa.starter; + +import org.hl7.fhir.r4.model.Patient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.server.LocalServerPort; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { + "hapi.fhir.custom-bean-packages=some.custom.pkg1", + "hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo", + "spring.datasource.url=jdbc:h2:mem:dbr4", + // "hapi.fhir.enable_repository_validating_interceptor=true", + "hapi.fhir.fhir_version=r4" +}) + +public class CustomInterceptorTest { + + @LocalServerPort + private int port; + + @Autowired + private IFhirResourceDao patientResourceDao; + + private IGenericClient client; + private FhirContext ctx; + + @BeforeEach + void setUp() { + ctx = FhirContext.forR4(); + ctx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); + ctx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); + String ourServerBase = "http://localhost:" + port + "/fhir/"; + client = ctx.newRestfulGenericClient(ourServerBase); + + // Properties props = new Properties(); + // props.put("spring.autoconfigure.exclude", "org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration"); + } + + @Test + void testAuditInterceptors() { + + // we registered two custom interceptors via the property 'hapi.fhir.custom-interceptor-classes' + // one is discovered as a Spring Bean, one instantiated via reflection + // both should be registered with the server and will add a custom extension to any Patient resource created + // so we can verify they were registered + + Patient pat = new Patient(); + String patId = client.create().resource(pat).execute().getId().getIdPart(); + + Patient readPat = client.read().resource(Patient.class).withId(patId).execute(); + + Assertions.assertNotNull(readPat.getExtensionByUrl("http://some.custom.pkg1/CustomInterceptorBean")); + Assertions.assertNotNull(readPat.getExtensionByUrl("http://some.custom.pkg1/CustomInterceptorPojo")); + + } +} diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java index 3a8404772f2..5cb0a4e7072 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java @@ -36,7 +36,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.fhir_version=r4", @@ -58,7 +58,7 @@ @ContextConfiguration(initializers = ElasticsearchLastNR4IT.Initializer.class) public class ElasticsearchLastNR4IT { - private IGenericClient ourClient; + private IGenericClient ourClient; private FhirContext ourCtx; private static final String ELASTIC_VERSION = "7.16.3"; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java index e20aff8ff8a..4369086733f 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java @@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "hapi.fhir.fhir_version=dstu2", "spring.datasource.url=jdbc:h2:mem:dbr2", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 926a5003841..850bdb36c98 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -15,7 +15,6 @@ import org.eclipse.jetty.websocket.client.WebSocketClient; import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.instance.model.api.IIdType; -import org.junit.Assert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -35,12 +34,14 @@ import static ca.uhn.fhir.util.TestUtil.waitForSize; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr3", - "hapi.fhir.cql_enabled=true", + "hapi.fhir.cr_enabled=true", "hapi.fhir.fhir_version=dstu3", "hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.allow_external_references=true", @@ -112,11 +113,11 @@ public void testCQLEvaluateMeasureEXM104() throws IOException { .execute(); List response = outParams.getParameter(); - Assert.assertFalse(response.isEmpty()); + assertFalse(response.isEmpty()); Parameters.ParametersParameterComponent component = response.get(0); - Assert.assertTrue(component.getResource() instanceof MeasureReport); + assertTrue(component.getResource() instanceof MeasureReport); MeasureReport report = (MeasureReport) component.getResource(); - Assert.assertEquals("Measure/"+measureId, report.getMeasure()); + assertEquals("Measure/"+measureId, report.getMeasure()); } private int loadDataFromDirectory(String theDirectoryName) throws IOException { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java index 00927220aee..9f19fcb74de 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java @@ -14,14 +14,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4b", "hapi.fhir.enable_repository_validating_interceptor=true", "hapi.fhir.fhir_version=r4b", "hapi.fhir.subscription.websocket_enabled=false", "hapi.fhir.mdm_enabled=false", - "hapi.fhir.implementationguides.dk-core.name=hl7.fhir.dk.core", - "hapi.fhir.implementationguides.dk-core.version=1.1.0", // Override is currently required when using MDM as the construction of the MDM // beans are ambiguous as they are constructed multiple places. This is evident // when running in a spring boot environment diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index 278a5f0ccc8..a5cc2d6e08a 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -13,6 +13,8 @@ import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Person; +import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Subscription; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Order; @@ -30,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = { +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.enable_repository_validating_interceptor=true", "hapi.fhir.fhir_version=r4", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java index ddbd6a77ac1..87e012197f9 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java @@ -32,7 +32,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr5", "hapi.fhir.fhir_version=r5", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java new file mode 100644 index 00000000000..3503338fc79 --- /dev/null +++ b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java @@ -0,0 +1,34 @@ +package ca.uhn.fhir.jpa.starter; + +import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * This class ensures that websockets work with + * Spring + Spring Boot + Jetty + */ +@Configuration +public class JpaStarterWebsocketDispatcherConfig { + + @Bean + public Jetty10WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { + return new Jetty10WebSocketServletWebServerCustomizer(); + } + + static class Jetty10WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { + + @Override + public void customize(JettyServletWebServerFactory factory) { + + factory.addServerCustomizers(server -> { + WebAppContext ctx = (WebAppContext) server.getHandler(); + JettyWebSocketServletContainerInitializer.configure(ctx, null); + }); + + } + } +} diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java index 9d340b12444..0241d5b20d2 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4-mt", "hapi.fhir.fhir_version=r4", @@ -68,7 +68,6 @@ public void testCreateAndReadInTenantA() { @Test public void testCreateAndReadInTenantB() { - // Create tenant A ourClientTenantInterceptor.setTenantId("DEFAULT"); ourClient diff --git a/src/test/java/some/custom/pkg1/CustomBean.java b/src/test/java/some/custom/pkg1/CustomBean.java new file mode 100644 index 00000000000..8160871f403 --- /dev/null +++ b/src/test/java/some/custom/pkg1/CustomBean.java @@ -0,0 +1,18 @@ +package some.custom.pkg1; + +import org.springframework.stereotype.Component; + +@Component +public class CustomBean { + + private String initFlag; + + public CustomBean() { + initFlag = "I am alive"; + } + + public String getInitFlag() { + return initFlag; + } + +} diff --git a/src/test/java/some/custom/pkg1/CustomInterceptorBean.java b/src/test/java/some/custom/pkg1/CustomInterceptorBean.java new file mode 100644 index 00000000000..5a0b4df19aa --- /dev/null +++ b/src/test/java/some/custom/pkg1/CustomInterceptorBean.java @@ -0,0 +1,31 @@ +package some.custom.pkg1; + +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.StringType; +import org.springframework.stereotype.Component; + +import ca.uhn.fhir.interceptor.api.Hook; +import ca.uhn.fhir.interceptor.api.Interceptor; +import ca.uhn.fhir.interceptor.api.Pointcut; +import ca.uhn.fhir.rest.api.RestOperationTypeEnum; +import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; + +@Interceptor +@Component +public class CustomInterceptorBean { + + @Hook(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED) + void preHandleResource(ServletRequestDetails servletRequestDetails, RestOperationTypeEnum opType) { + IBaseResource resource = servletRequestDetails.getResource(); + + // add an extension before saving the resource to mark it + if (opType == RestOperationTypeEnum.CREATE && resource instanceof Patient) { + Patient pat = (Patient) resource; + Extension ext = pat.addExtension(); + ext.setUrl("http://some.custom.pkg1/CustomInterceptorBean"); + ext.setValue(new StringType("CustomInterceptorBean wuz here")); + } + } +} diff --git a/src/test/java/some/custom/pkg1/CustomInterceptorPojo.java b/src/test/java/some/custom/pkg1/CustomInterceptorPojo.java new file mode 100644 index 00000000000..1df67c9acd6 --- /dev/null +++ b/src/test/java/some/custom/pkg1/CustomInterceptorPojo.java @@ -0,0 +1,26 @@ +package some.custom.pkg1; + +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.StringType; +import ca.uhn.fhir.interceptor.api.Hook; +import ca.uhn.fhir.interceptor.api.Pointcut; +import ca.uhn.fhir.rest.api.RestOperationTypeEnum; +import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; + +public class CustomInterceptorPojo { + + @Hook(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED) + void preHandleResource(ServletRequestDetails servletRequestDetails, RestOperationTypeEnum opType) { + IBaseResource resource = servletRequestDetails.getResource(); + + // add an extension before saving the resource to mark it + if (opType == RestOperationTypeEnum.CREATE && resource instanceof Patient) { + Patient pat = (Patient) resource; + Extension ext = pat.addExtension(); + ext.setUrl("http://some.custom.pkg1/CustomInterceptorPojo"); + ext.setValue(new StringType("CustomInterceptorPojo wuz here")); + } + } +} diff --git a/src/test/resources/application.yaml b/src/test/resources/application.yaml index 4794df57468..89229c9f0a1 100644 --- a/src/test/resources/application.yaml +++ b/src/test/resources/application.yaml @@ -78,7 +78,7 @@ hapi: # allow_multiple_delete: true # allow_override_default_search_params: true # auto_create_placeholder_reference_targets: false - # cql_enabled: true + # cr_enabled: true # default_encoding: JSON # default_pretty_print: true # default_page_size: 20