merge master

This commit is contained in:
Justin McKelvy
2023-09-18 18:41:34 -06:00
38 changed files with 447 additions and 391 deletions

View File

@@ -11,6 +11,4 @@ helm-extra-args: --timeout 300s
upgrade: true upgrade: true
skip-missing-values: true skip-missing-values: true
release-label: release release-label: release
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
release-name-template: "helm-v{{ .Version }}" release-name-template: "helm-v{{ .Version }}"

View File

@@ -9,10 +9,14 @@ on:
jobs: jobs:
release: release:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Add workspace as safe directory
run: |
git config --global --add safe.directory /__w/hapi-fhir-jpaserver-starter/hapi-fhir-jpaserver-starter
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -21,14 +25,11 @@ jobs:
git config user.name "$GITHUB_ACTOR" git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Add bitnami repo
run: helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Update dependencies - name: Update dependencies
run: find charts/ ! -path charts/ -maxdepth 1 -type d -exec helm dependency update {} \; run: find charts/ ! -path charts/ -maxdepth 1 -type d -exec helm dependency update {} \;
- name: Run chart-releaser - name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.0 uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
with: with:
config: .github/ct/config.yaml config: .github/ct/config.yaml
env: env:

View File

@@ -9,8 +9,8 @@ on:
jobs: jobs:
lint: lint:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
container: quay.io/helmpack/chart-testing:v3.4.0 container: quay.io/helmpack/chart-testing:v3.8.0@sha256:f058c660a28d99a9394ae081d98921efe068079531f247c86b8054e3c9d407aa
steps: steps:
- name: Install helm-docs - name: Install helm-docs
working-directory: /tmp working-directory: /tmp
@@ -22,11 +22,14 @@ jobs:
chmod +x /usr/local/bin/helm-docs && \ chmod +x /usr/local/bin/helm-docs && \
helm-docs --version helm-docs --version
- name: Add workspace as safe directory
run: |
git config --global --add safe.directory /__w/hapi-fhir-jpaserver-starter/hapi-fhir-jpaserver-starter
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Check if documentation is up-to-date - name: Check if documentation is up-to-date
run: helm-docs && git diff --exit-code HEAD run: helm-docs && git diff --exit-code HEAD
@@ -34,20 +37,20 @@ jobs:
run: ct lint --config .github/ct/config.yaml run: ct lint --config .github/ct/config.yaml
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
k8s-version: [1.22.9, 1.23.6, 1.24.1] k8s-version: [1.25.9, 1.26.4, 1.27.2]
needs: needs:
- lint - lint
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up chart-testing - name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1 uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
- name: Run chart-testing (list-changed) - name: Run chart-testing (list-changed)
id: list-changed id: list-changed
@@ -58,13 +61,12 @@ jobs:
fi fi
- name: Create k8s Kind Cluster - name: Create k8s Kind Cluster
uses: helm/kind-action@v1.2.0 uses: helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
if: steps.list-changed.outputs.changed == 'true' if: ${{ steps.list-changed.outputs.changed == 'true' }}
with: with:
version: v0.14.0
cluster_name: kind-cluster-k8s-${{ matrix.k8s-version }} cluster_name: kind-cluster-k8s-${{ matrix.k8s-version }}
node_image: kindest/node:v${{ matrix.k8s-version }} node_image: kindest/node:v${{ matrix.k8s-version }}
- name: Run chart-testing (install) - name: Run chart-testing (install)
run: ct install --config .github/ct/config.yaml run: ct install --config .github/ct/config.yaml
if: steps.list-changed.outputs.changed == 'true' if: ${{ steps.list-changed.outputs.changed == 'true' }}

View File

@@ -1,7 +1,7 @@
FROM maven:3.8-openjdk-17-slim as build-hapi FROM docker.io/library/maven:3.9.2-eclipse-temurin-17 AS build-hapi
WORKDIR /tmp/hapi-fhir-jpaserver-starter WORKDIR /tmp/hapi-fhir-jpaserver-starter
ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.17.0 ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.26.0
RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar
COPY pom.xml . COPY pom.xml .
@@ -18,7 +18,7 @@ RUN mkdir /app && cp /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /app/main.
########### bitnami tomcat version is suitable for debugging and comes with a shell ########### bitnami tomcat version is suitable for debugging and comes with a shell
########### it can be built using eg. `docker build --target tomcat .` ########### it can be built using eg. `docker build --target tomcat .`
FROM bitnami/tomcat:9.0 as tomcat FROM bitnami/tomcat:9.0 AS tomcat
RUN rm -rf /opt/bitnami/tomcat/webapps/ROOT && \ RUN rm -rf /opt/bitnami/tomcat/webapps/ROOT && \
mkdir -p /opt/bitnami/hapi/data/hapi/lucenefiles && \ mkdir -p /opt/bitnami/hapi/data/hapi/lucenefiles && \
@@ -36,7 +36,7 @@ COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/opente
ENV ALLOW_EMPTY_PASSWORD=yes ENV ALLOW_EMPTY_PASSWORD=yes
########### distroless brings focus on security and runs on plain spring boot - this is the default image ########### distroless brings focus on security and runs on plain spring boot - this is the default image
FROM gcr.io/distroless/java17-debian11:nonroot as default FROM gcr.io/distroless/java17-debian11:nonroot AS default
# 65532 is the nonroot user's uid # 65532 is the nonroot user's uid
# used here instead of the name to allow Kubernetes to easily detect that the container # used here instead of the name to allow Kubernetes to easily detect that the container
# is running as a non-root (uid != 0) user. # is running as a non-root (uid != 0) user.
@@ -46,4 +46,4 @@ WORKDIR /app
COPY --chown=nonroot:nonroot --from=build-distroless /app /app COPY --chown=nonroot:nonroot --from=build-distroless /app /app
COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app
ENTRYPOINT ["java", "--class-path", "/app/main.war", "-Dloader.path=main.war!/WEB-INF/classes/,main.war!/WEB-INF/,/app/extra-classes", "org.springframework.boot.loader.PropertiesLauncher", "app/main.war"] ENTRYPOINT ["java", "--class-path", "/app/main.war", "-Dloader.path=main.war!/WEB-INF/classes/,main.war!/WEB-INF/,/app/extra-classes", "org.springframework.boot.loader.PropertiesLauncher"]

View File

@@ -235,7 +235,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos
```bash ```bash
mvn clean package spring-boot:repackage -Pboot && java -jar target/ROOT.war mvn clean package spring-boot:repackage -Pboot && java -jar target/ROOT.war
``` ```
Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
```yaml ```yaml
tester: tester:
@@ -250,7 +250,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos
```bash ```bash
mvn clean package com.google.cloud.tools:jib-maven-plugin:dockerBuild -Dimage=distroless-hapi && docker run -p 8080:8080 distroless-hapi mvn clean package com.google.cloud.tools:jib-maven-plugin:dockerBuild -Dimage=distroless-hapi && docker run -p 8080:8080 distroless-hapi
``` ```
Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
```yaml ```yaml
tester: tester:
@@ -266,7 +266,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos
```bash ```bash
./build-docker-image.sh && docker run -p 8080:8080 hapi-fhir/hapi-fhir-jpaserver-starter:latest ./build-docker-image.sh && docker run -p 8080:8080 hapi-fhir/hapi-fhir-jpaserver-starter:latest
``` ```
Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
```yaml ```yaml
tester: tester:
@@ -307,7 +307,7 @@ spring:
# Then comment all hibernate.search.backend.* # 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. Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicitly 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.
### Microsoft SQL Server configuration ### Microsoft SQL Server configuration
@@ -322,14 +322,14 @@ spring:
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
``` ```
Also, make sure you are not setting the Hibernate dialect explicitly, in other words remove any lines similar to: Also, make sure you are not setting the Hibernate dialect explicitly, in other words, remove any lines similar to:
``` ```
hibernate.dialect: {some none Microsoft SQL dialect} hibernate.dialect: {some none Microsoft SQL dialect}
``` ```
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. Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicitly 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.
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. 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.
@@ -373,7 +373,7 @@ Again, browse to the following link to use the server (note that the port 8080 m
[http://localhost:8080/](http://localhost:8080/) [http://localhost:8080/](http://localhost:8080/)
You will then be able access the JPA server e.g. using http://localhost:8080/fhir/metadata. You will then be able to access the JPA server e.g. using http://localhost:8080/fhir/metadata.
If you would like it to be hosted at eg. hapi-fhir-jpaserver, eg. http://localhost:8080/hapi-fhir-jpaserver/ or http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata - then rename the WAR file to ```hapi-fhir-jpaserver.war``` and adjust the overlay configuration accordingly e.g. If you would like it to be hosted at eg. hapi-fhir-jpaserver, eg. http://localhost:8080/hapi-fhir-jpaserver/ or http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata - then rename the WAR file to ```hapi-fhir-jpaserver.war``` and adjust the overlay configuration accordingly e.g.
@@ -390,7 +390,7 @@ If you would like it to be hosted at eg. hapi-fhir-jpaserver, eg. http://localho
## Deploy with docker compose ## Deploy with docker compose
Docker compose is a simple option to build and deploy container. To deploy with docker compose, you should build the project Docker compose is a simple option to build and deploy containers. To deploy with docker compose, you should build the project
with `mvn clean install` and then bring up the containers with `docker-compose up -d --build`. The server can be with `mvn clean install` and then bring up the containers with `docker-compose up -d --build`. The server can be
reached at http://localhost:8080/. reached at http://localhost:8080/.

View File

@@ -1,6 +1,6 @@
dependencies: dependencies:
- name: postgresql - name: postgresql
repository: https://charts.bitnami.com/bitnami repository: oci://registry-1.docker.io/bitnamicharts
version: 12.1.2 version: 12.5.6
digest: sha256:525689611a29f90b0bc8cd674df5d97024c99eda8104216390f6747904fd0208 digest: sha256:4d21dbc02bbdb55b957b0093e37376853727de82396abfadfaf1d738bd51b8e6
generated: "2022-11-21T22:55:45.1699395+01:00" generated: "2023-06-03T20:58:45.922102213+02:00"

View File

@@ -7,17 +7,21 @@ sources:
- https://github.com/hapifhir/hapi-fhir-jpaserver-starter - https://github.com/hapifhir/hapi-fhir-jpaserver-starter
dependencies: dependencies:
- name: postgresql - name: postgresql
version: 12.1.2 version: 12.5.6
repository: https://charts.bitnami.com/bitnami repository: oci://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled condition: postgresql.enabled
appVersion: 6.2.2 appVersion: 6.6.0
version: 0.11.1 version: 0.13.0
annotations: annotations:
artifacthub.io/license: Apache-2.0 artifacthub.io/license: Apache-2.0
artifacthub.io/changes: | artifacthub.io/changes: |
# When using the list of objects option the valid supported kinds are # When using the list of objects option the valid supported kinds are
# added, changed, deprecated, removed, fixed, and security. # added, changed, deprecated, removed, fixed, and security.
- kind: added
description: allow specifying application properties via yaml config
- kind: added
description: allow setting resource limits and requests for the Helm test pods
- kind: changed - kind: changed
description: updated HAPI FHIR JPA Server app image version to v6.2.2 description: updated curl used by helm tests to version to v8.2.0
- kind: changed - kind: changed
description: updated curl used by helm tests to version to v7.87.0 description: allow disabling the liveness-, readiness-, and startup-probes entirely

View File

@@ -1,6 +1,6 @@
# HAPI FHIR JPA Server Starter Helm Chart # HAPI FHIR JPA Server Starter Helm Chart
![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) ![Version: 0.13.0](https://img.shields.io/badge/Version-0.13.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.6.0](https://img.shields.io/badge/AppVersion-6.6.0-informational?style=flat-square)
This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes environment. This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes environment.
@@ -8,11 +8,14 @@ This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes e
```sh ```sh
helm repo add hapifhir https://hapifhir.github.io/hapi-fhir-jpaserver-starter/ helm repo add hapifhir https://hapifhir.github.io/hapi-fhir-jpaserver-starter/
helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver helm install hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver
``` ```
> ⚠ By default, the included [PostgreSQL Helm chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#upgrading) ## Requirements
> auto-generates a random password for the database which may cause problems when upgrading the chart (see [here for details](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#upgrading)).
| Repository | Name | Version |
|------------|------|---------|
| oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 |
## Values ## Values
@@ -27,12 +30,13 @@ helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpas
| externalDatabase.password | string | `""` | database password | | externalDatabase.password | string | `""` | database password |
| externalDatabase.port | int | `5432` | database port number | | externalDatabase.port | int | `5432` | database port number |
| externalDatabase.user | string | `"fhir"` | username for the external database | | externalDatabase.user | string | `"fhir"` | username for the external database |
| extraConfig | string | `""` | additional Spring Boot application config. Mounted as a file and automatically loaded by the application. |
| extraEnv | list | `[]` | extra environment variables to set on the server container | | extraEnv | list | `[]` | extra environment variables to set on the server container |
| fullnameOverride | string | `""` | override the chart fullname | | fullnameOverride | string | `""` | override the chart fullname |
| image.pullPolicy | string | `"IfNotPresent"` | image pullPolicy to use | | image.pullPolicy | string | `"IfNotPresent"` | image pullPolicy to use |
| image.registry | string | `"docker.io"` | registry where the HAPI FHIR server image is hosted | | 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.repository | string | `"hapiproject/hapi"` | the path inside the repository |
| 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. | | image.tag | string | `"v6.6.0@sha256:c00367865ae5dad4e171cbb68bfc1c39818854079d1565bee4c86a45e78335d0"` | 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 | | 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.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 | | ingress.enabled | bool | `false` | whether to create an Ingress to expose the FHIR server HTTP endpoint |
@@ -40,11 +44,6 @@ helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpas
| ingress.hosts[0].pathType | string | `"ImplementationSpecific"` | | | ingress.hosts[0].pathType | string | `"ImplementationSpecific"` | |
| ingress.hosts[0].paths[0] | string | `"/"` | | | ingress.hosts[0].paths[0] | string | `"/"` | |
| ingress.tls | list | `[]` | ingress TLS config | | ingress.tls | list | `[]` | ingress TLS config |
| livenessProbe.failureThreshold | int | `5` | |
| livenessProbe.initialDelaySeconds | int | `30` | |
| livenessProbe.periodSeconds | int | `20` | |
| livenessProbe.successThreshold | int | `1` | |
| livenessProbe.timeoutSeconds | int | `30` | |
| metrics.service.port | int | `8081` | | | metrics.service.port | int | `8081` | |
| metrics.serviceMonitor.additionalLabels | object | `{}` | additional labels to apply to the ServiceMonitor object, e.g. `release: prometheus` | | metrics.serviceMonitor.additionalLabels | object | `{}` | additional labels to apply to the ServiceMonitor object, e.g. `release: prometheus` |
| metrics.serviceMonitor.enabled | bool | `false` | if enabled, creates a ServiceMonitor instance for Prometheus Operator-based monitoring | | metrics.serviceMonitor.enabled | bool | `false` | if enabled, creates a ServiceMonitor instance for Prometheus Operator-based monitoring |
@@ -62,11 +61,6 @@ helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpas
| postgresql.primary.containerSecurityContext.capabilities.drop[0] | string | `"ALL"` | | | postgresql.primary.containerSecurityContext.capabilities.drop[0] | string | `"ALL"` | |
| postgresql.primary.containerSecurityContext.runAsNonRoot | bool | `true` | | | postgresql.primary.containerSecurityContext.runAsNonRoot | bool | `true` | |
| postgresql.primary.containerSecurityContext.seccompProfile.type | string | `"RuntimeDefault"` | | | postgresql.primary.containerSecurityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
| readinessProbe.failureThreshold | int | `5` | |
| readinessProbe.initialDelaySeconds | int | `30` | |
| readinessProbe.periodSeconds | int | `20` | |
| readinessProbe.successThreshold | int | `1` | |
| readinessProbe.timeoutSeconds | int | `20` | |
| replicaCount | int | `1` | number of replicas to deploy | | replicaCount | int | `1` | number of replicas to deploy |
| resources | object | `{}` | configure the FHIR server's resource requests and limits | | resources | object | `{}` | configure the FHIR server's resource requests and limits |
| securityContext.allowPrivilegeEscalation | bool | `false` | | | securityContext.allowPrivilegeEscalation | bool | `false` | |
@@ -79,18 +73,14 @@ helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpas
| securityContext.seccompProfile.type | string | `"RuntimeDefault"` | | | securityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
| service.port | int | `8080` | port where the server will be exposed at | | service.port | int | `8080` | port where the server will be exposed at |
| service.type | string | `"ClusterIP"` | service type | | service.type | string | `"ClusterIP"` | service type |
| startupProbe.failureThreshold | int | `10` | | | tests.resources | object | `{}` | configure the test pods resource requests and limits |
| startupProbe.initialDelaySeconds | int | `30` | |
| startupProbe.periodSeconds | int | `30` | |
| startupProbe.successThreshold | int | `1` | |
| startupProbe.timeoutSeconds | int | `30` | |
| tolerations | list | `[]` | pod tolerations | | tolerations | list | `[]` | pod tolerations |
| topologySpreadConstraints | list | `[]` | pod topology spread configuration see: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#api | | topologySpreadConstraints | list | `[]` | pod topology spread configuration see: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#api |
## Development ## Development
To update the Helm chart when a new version of the `hapiproject/hapi` image is released, [values.yaml](values.yaml) `image.tag` and the [Chart.yaml](Chart.yaml)'s To update the Helm chart when a new version of the `hapiproject/hapi` image is released, [values.yaml](values.yaml) `image.tag` and the [Chart.yaml](Chart.yaml)'s
`version` and optionally the `appVersion` field on major releases need to be updated. Afterwards, re-generate the [README.md](README.md) `version` and optionally the `appVersion` field need to be updated. Afterwards, re-generate the [README.md](README.md)
by running: by running:
```sh ```sh

View File

@@ -8,18 +8,17 @@ This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes e
```sh ```sh
helm repo add hapifhir https://hapifhir.github.io/hapi-fhir-jpaserver-starter/ helm repo add hapifhir https://hapifhir.github.io/hapi-fhir-jpaserver-starter/
helm install --render-subchart-notes hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver helm install hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver
``` ```
> ⚠ By default, the included [PostgreSQL Helm chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#upgrading) {{ template "chart.requirementsSection" . }}
> auto-generates a random password for the database which may cause problems when upgrading the chart (see [here for details](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#upgrading)).
{{ template "chart.valuesSection" . }} {{ template "chart.valuesSection" . }}
## Development ## Development
To update the Helm chart when a new version of the `hapiproject/hapi` image is released, [values.yaml](values.yaml) `image.tag` and the [Chart.yaml](Chart.yaml)'s To update the Helm chart when a new version of the `hapiproject/hapi` image is released, [values.yaml](values.yaml) `image.tag` and the [Chart.yaml](Chart.yaml)'s
`version` and optionally the `appVersion` field on major releases need to be updated. Afterwards, re-generate the [README.md](README.md) `version` and optionally the `appVersion` field need to be updated. Afterwards, re-generate the [README.md](README.md)
by running: by running:
```sh ```sh

View File

@@ -0,0 +1,17 @@
extraConfig: |
hapi:
fhir:
cr_enabled: true
tester:
home:
name: Hello HAPI FHIR
server_address: "http://fhir-server.127.0.0.1.nip.io/fhir"
refuse_to_fetch_third_party_urls: true
fhir_version: R4
ingress:
enabled: true
hosts:
- host: fhir-server.127.0.0.1.nip.io
pathType: ImplementationSpecific
paths: ["/"]

View File

@@ -0,0 +1,11 @@
{{- if .Values.extraConfig -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hapi-fhir-jpaserver.fullname" . }}-application-config
labels:
{{- include "hapi-fhir-jpaserver.labels" . | nindent 4 }}
data:
application-extra.yaml: |-
{{ .Values.extraConfig | nindent 4 }}
{{- end }}

View File

@@ -30,7 +30,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers: initContainers:
- name: wait-for-db-to-be-ready - name: wait-for-db-to-be-ready
image: docker.io/bitnami/postgresql:15.1.0-debian-11-r0@sha256:27915588d5203a10a1c23624d9c81644437f33b7c224e25f79bcd9bd09bbb8e2 image: docker.io/bitnami/postgresql:15.3.0-debian-11-r7@sha256:cc301eef743685f4f69d1d719853988e8a9650c90fd9521f4742ce400b3fdf6a
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
{{- with .Values.restrictedContainerSecurityContext }} {{- with .Values.restrictedContainerSecurityContext }}
securityContext: securityContext:
@@ -63,38 +63,17 @@ spec:
- name: http-metrics - name: http-metrics
containerPort: 8081 containerPort: 8081
protocol: TCP protocol: TCP
startupProbe:
httpGet:
path: /readyz
port: http
{{- with .Values.startupProbe }} {{- with .Values.startupProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }} startupProbe:
periodSeconds: {{ .periodSeconds }} {{- toYaml . | nindent 12 }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }} {{- end }}
readinessProbe:
httpGet:
path: /readyz
port: http
{{- with .Values.readinessProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
livenessProbe:
httpGet:
path: /livez
port: http
{{- with .Values.livenessProbe }} {{- with .Values.livenessProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }} livenessProbe:
periodSeconds: {{ .periodSeconds }} {{- toYaml . | nindent 12 }}
timeoutSeconds: {{ .timeoutSeconds }} {{- end }}
successThreshold: {{ .successThreshold }} {{- with .Values.readinessProbe }}
failureThreshold: {{ .failureThreshold }} readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
@@ -118,6 +97,10 @@ spec:
value: "true" value: "true"
- name: MANAGEMENT_SERVER_PORT - name: MANAGEMENT_SERVER_PORT
value: "8081" value: "8081"
{{- if .Values.extraConfig }}
- name: SPRING_CONFIG_IMPORT
value: "/app/config/application-extra.yaml"
{{- end }}
{{- if .Values.extraEnv }} {{- if .Values.extraEnv }}
{{ toYaml .Values.extraEnv | nindent 12 }} {{ toYaml .Values.extraEnv | nindent 12 }}
{{- end }} {{- end }}
@@ -126,6 +109,12 @@ spec:
name: tmp-volume name: tmp-volume
- mountPath: /app/target - mountPath: /app/target
name: lucenefiles-volume name: lucenefiles-volume
{{- if .Values.extraConfig }}
- name: application-extra-config
mountPath: /app/config/application-extra.yaml
readOnly: true
subPath: application-extra.yaml
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@@ -147,3 +136,8 @@ spec:
emptyDir: {} emptyDir: {}
- name: lucenefiles-volume - name: lucenefiles-volume
emptyDir: {} emptyDir: {}
{{- if .Values.extraConfig }}
- name: application-extra-config
configMap:
name: {{ include "hapi-fhir-jpaserver.fullname" . }}-application-config
{{- end }}

View File

@@ -11,20 +11,17 @@ spec:
restartPolicy: Never restartPolicy: Never
containers: containers:
- name: test-metadata-endpoint - name: test-metadata-endpoint
image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd image: "{{ .Values.curl.image.registry }}/{{ .Values.curl.image.repository }}:{{ .Values.curl.image.tag }}"
command: ["curl", "--fail-with-body"] command: ["curl", "--fail-with-body"]
args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/metadata?_summary=true"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/metadata?_summary=true"]
{{- with .Values.restrictedContainerSecurityContext }} {{- with .Values.restrictedContainerSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.tests.resources }}
resources: resources:
limits: {{- toYaml . | nindent 8 }}
cpu: 100m {{- end }}
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
livenessProbe: livenessProbe:
exec: exec:
command: ["true"] command: ["true"]
@@ -32,20 +29,17 @@ spec:
exec: exec:
command: ["true"] command: ["true"]
- name: test-patient-endpoint - name: test-patient-endpoint
image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd image: "{{ .Values.curl.image.registry }}/{{ .Values.curl.image.repository }}:{{ .Values.curl.image.tag }}"
command: ["curl", "--fail-with-body"] command: ["curl", "--fail-with-body"]
args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/Patient?_count=1&_summary=true"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.service.port }}/fhir/Patient?_count=1&_summary=true"]
{{- with .Values.restrictedContainerSecurityContext }} {{- with .Values.restrictedContainerSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.tests.resources }}
resources: resources:
limits: {{- toYaml . | nindent 8 }}
cpu: 100m {{- end }}
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
livenessProbe: livenessProbe:
exec: exec:
command: ["true"] command: ["true"]
@@ -53,20 +47,17 @@ spec:
exec: exec:
command: ["true"] command: ["true"]
- name: test-metrics-endpoint - name: test-metrics-endpoint
image: docker.io/curlimages/curl:7.87.0@sha256:f7f265d5c64eb4463a43a99b6bf773f9e61a50aaa7cefaf564f43e42549a01dd image: "{{ .Values.curl.image.registry }}/{{ .Values.curl.image.repository }}:{{ .Values.curl.image.tag }}"
command: ["curl", "--fail-with-body"] command: ["curl", "--fail-with-body"]
args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.metrics.service.port }}/actuator/prometheus"] args: ["http://{{ include "hapi-fhir-jpaserver.fullname" . }}:{{ .Values.metrics.service.port }}/actuator/prometheus"]
{{- with .Values.restrictedContainerSecurityContext }} {{- with .Values.restrictedContainerSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.tests.resources }}
resources: resources:
limits: {{- toYaml . | nindent 8 }}
cpu: 100m {{- end }}
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
livenessProbe: livenessProbe:
exec: exec:
command: ["true"] command: ["true"]

View File

@@ -7,7 +7,7 @@ image:
# -- the path inside the repository # -- the path inside the repository
repository: hapiproject/hapi 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. # -- 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.2@sha256:9c4e8af94d81ac0049dbb589e4cd855bf78c9c13be6f6844e814c63d63545b44" tag: "v6.6.0@sha256:c00367865ae5dad4e171cbb68bfc1c39818854079d1565bee4c86a45e78335d0"
# -- image pullPolicy to use # -- image pullPolicy to use
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@@ -131,27 +131,42 @@ postgresql:
seccompProfile: seccompProfile:
type: RuntimeDefault type: RuntimeDefault
# -- readiness probe
# @ignored
readinessProbe: readinessProbe:
httpGet:
path: /readyz
port: http
failureThreshold: 5 failureThreshold: 5
initialDelaySeconds: 30 initialDelaySeconds: 30
periodSeconds: 20 periodSeconds: 20
successThreshold: 1 successThreshold: 1
timeoutSeconds: 20 timeoutSeconds: 20
startupProbe: # -- liveness probe
failureThreshold: 10 # @ignored
initialDelaySeconds: 30
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 30
livenessProbe: livenessProbe:
httpGet:
path: /livez
port: http
failureThreshold: 5 failureThreshold: 5
initialDelaySeconds: 30 initialDelaySeconds: 30
periodSeconds: 20 periodSeconds: 20
successThreshold: 1 successThreshold: 1
timeoutSeconds: 30 timeoutSeconds: 30
# -- startup probe
# @ignored
startupProbe:
httpGet:
path: /readyz
port: http
failureThreshold: 10
initialDelaySeconds: 30
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 30
externalDatabase: externalDatabase:
# -- external database host used with `postgresql.enabled=false` # -- external database host used with `postgresql.enabled=false`
host: localhost host: localhost
@@ -208,3 +223,32 @@ restrictedContainerSecurityContext:
runAsGroup: 65534 runAsGroup: 65534
seccompProfile: seccompProfile:
type: RuntimeDefault type: RuntimeDefault
# @ignored
curl:
image:
registry: docker.io
repository: curlimages/curl
tag: 8.2.0@sha256:daf3f46a2639c1613b25e85c9ee4193af8a1d538f92483d67f9a3d7f21721827
tests:
# -- configure the test pods resource requests and limits
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# -- additional Spring Boot application config. Mounted as a file and automatically loaded by the application.
extraConfig: ""
# # For example:
# |
# hapi:
# fhir:
# implementationguides:
# gh_0_1_0:
# url: https://build.fhir.org/ig/hl7-eu/gravitate-health/package.tgz
# name: hl7.eu.fhir.gh
# version: 0.1.0

View File

@@ -247,6 +247,12 @@
</dependency> </dependency>
<!-- The following dependencies are only needed for automated unit tests, you do not neccesarily need them to run the example. --> <!-- The following dependencies are only needed for automated unit tests, you do not neccesarily need them to run the example. -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId> <artifactId>jetty-servlets</artifactId>

View File

@@ -1,32 +1,32 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
import ca.uhn.fhir.rest.api.EncodingEnum;
import org.cqframework.cql.cql2elm.CqlCompilerException; import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.CqlTranslator; import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryBuilder; import org.cqframework.cql.cql2elm.LibraryBuilder;
import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.google.common.collect.ImmutableList; import java.util.ArrayList;
import java.util.HashSet;
import ca.uhn.fhir.context.FhirVersionEnum; import java.util.List;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum; import java.util.Map;
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import java.util.Objects;
import ca.uhn.fhir.rest.api.EncodingEnum; import java.util.Set;
@ConfigurationProperties(prefix = "hapi.fhir") @ConfigurationProperties(prefix = "hapi.fhir")
@Configuration @Configuration
@EnableConfigurationProperties @EnableConfigurationProperties
public class AppProperties { public class AppProperties {
private Boolean cr_enabled = false;
//cql settings //cql settings
private Boolean cql_use_embedded_libraries = true; private Boolean cql_use_embedded_libraries = true;
private Boolean cql_runtime_debug_logging_enabled = false; private Boolean cql_runtime_debug_logging_enabled = false;
@@ -56,7 +56,6 @@ public class AppProperties {
// Care-gaps Settings // Care-gaps Settings
private String caregaps_reporter = "default"; private String caregaps_reporter = "default";
private String caregaps_section_author = "default"; private String caregaps_section_author = "default";
private Boolean cr_enabled = false;
private Boolean ips_enabled = false; private Boolean ips_enabled = false;
private Boolean openapi_enabled = false; private Boolean openapi_enabled = false;
private Boolean mdm_enabled = false; private Boolean mdm_enabled = false;
@@ -68,6 +67,7 @@ public class AppProperties {
private Boolean allow_multiple_delete = false; private Boolean allow_multiple_delete = false;
private Boolean allow_override_default_search_params = true; private Boolean allow_override_default_search_params = true;
private Boolean auto_create_placeholder_reference_targets = false; private Boolean auto_create_placeholder_reference_targets = false;
private final Set<String> auto_version_reference_at_paths = new HashSet<>();
private Boolean dao_scheduling_enabled = true; private Boolean dao_scheduling_enabled = true;
private Boolean delete_expunge_enabled = false; private Boolean delete_expunge_enabled = false;
private Boolean enable_index_missing_fields = false; private Boolean enable_index_missing_fields = false;
@@ -98,17 +98,21 @@ public class AppProperties {
private List<String> supported_resource_types = new ArrayList<>(); private List<String> supported_resource_types = new ArrayList<>();
private List<Bundle.BundleType> allowed_bundle_types = null; private List<Bundle.BundleType> allowed_bundle_types = null;
private Boolean narrative_enabled = true; private Boolean narrative_enabled = true;
private Validation validation = new Validation(); private Validation validation = new Validation();
private Map<String, Tester> tester = new HashMap<>(); private Map<String, Tester> tester = null;
private Logger logger = new Logger(); private Logger logger = new Logger();
private Subscription subscription = new Subscription(); private Subscription subscription = new Subscription();
private Cors cors = null; private Cors cors = null;
private Partitioning partitioning = null; private Partitioning partitioning = null;
private Boolean install_transitive_ig_dependencies = true; private Boolean install_transitive_ig_dependencies = true;
private Boolean reload_existing_implementationguides = false; private Boolean reload_existing_implementationguides = false;
private Map<String, ImplementationGuide> implementationGuides = null; private Map<String, PackageInstallationSpec> implementationGuides = null;
private String staticLocation = null; private String staticLocation = null;
private String staticLocationPrefix = "/static";
private Boolean lastn_enabled = false; private Boolean lastn_enabled = false;
private boolean store_resource_in_lucene_index_enabled = false; private boolean store_resource_in_lucene_index_enabled = false;
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED; private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
@@ -118,14 +122,24 @@ public class AppProperties {
private Integer bundle_batch_pool_size = 20; private Integer bundle_batch_pool_size = 20;
private Integer bundle_batch_pool_max_size = 100; private Integer bundle_batch_pool_max_size = 100;
private final List<String> local_base_urls = new ArrayList<>(); private final Set<String> local_base_urls = new HashSet<>();
private final List<String> custom_interceptor_classes = new ArrayList<>(); private final List<String> custom_interceptor_classes = new ArrayList<>();
public String getStaticLocationPrefix() {
return staticLocationPrefix;
}
public void setStaticLocationPrefix(String staticLocationPrefix) {
this.staticLocationPrefix = staticLocationPrefix;
}
public List<String> getCustomInterceptorClasses() { public List<String> getCustomInterceptorClasses() {
return custom_interceptor_classes; return custom_interceptor_classes;
} }
public String getStaticLocation() { public String getStaticLocation() {
return staticLocation; return staticLocation;
} }
@@ -134,6 +148,7 @@ public class AppProperties {
this.staticLocation = staticLocation; this.staticLocation = staticLocation;
} }
public Boolean getOpenapi_enabled() { public Boolean getOpenapi_enabled() {
return openapi_enabled; return openapi_enabled;
} }
@@ -166,11 +181,11 @@ public class AppProperties {
this.defer_indexing_for_codesystems_of_size = defer_indexing_for_codesystems_of_size; this.defer_indexing_for_codesystems_of_size = defer_indexing_for_codesystems_of_size;
} }
public Map<String, ImplementationGuide> getImplementationGuides() { public Map<String, PackageInstallationSpec> getImplementationGuides() {
return implementationGuides; return implementationGuides;
} }
public void setImplementationGuides(Map<String, ImplementationGuide> implementationGuides) { public void setImplementationGuides(Map<String, PackageInstallationSpec> implementationGuides) {
this.implementationGuides = implementationGuides; this.implementationGuides = implementationGuides;
} }
@@ -182,6 +197,14 @@ public class AppProperties {
this.partitioning = partitioning; this.partitioning = partitioning;
} }
public Boolean getCr_enabled() {
return cr_enabled;
}
public void setCr_enabled(Boolean cr_enabled) {
this.cr_enabled = cr_enabled;
}
public boolean isCqlUseEmbeddedLibraries() { public boolean isCqlUseEmbeddedLibraries() {
return cql_use_embedded_libraries; return cql_use_embedded_libraries;
} }
@@ -382,14 +405,6 @@ public class AppProperties {
this.cql_compiler_translator_format = cqlTranslatorFormat; this.cql_compiler_translator_format = cqlTranslatorFormat;
} }
public Boolean getCr_enabled() {
return cr_enabled;
}
public void setCr_enabled(Boolean cr_enabled) {
this.cr_enabled = cr_enabled;
}
public String getCareGapsReporter() { public String getCareGapsReporter() {
return caregaps_reporter; return caregaps_reporter;
} }
@@ -401,6 +416,7 @@ public class AppProperties {
public void setCareGapsReporter(String theCareGapsReporter) { public void setCareGapsReporter(String theCareGapsReporter) {
this.caregaps_reporter = theCareGapsReporter; this.caregaps_reporter = theCareGapsReporter;
} }
public Boolean getIps_enabled() { public Boolean getIps_enabled() {
return ips_enabled; return ips_enabled;
} }
@@ -409,6 +425,7 @@ public class AppProperties {
this.ips_enabled = ips_enabled; this.ips_enabled = ips_enabled;
} }
public Boolean getMdm_enabled() { public Boolean getMdm_enabled() {
return mdm_enabled; return mdm_enabled;
} }
@@ -548,6 +565,10 @@ public class AppProperties {
this.auto_create_placeholder_reference_targets = auto_create_placeholder_reference_targets; this.auto_create_placeholder_reference_targets = auto_create_placeholder_reference_targets;
} }
public Set<String> getAuto_version_reference_at_paths() {
return auto_version_reference_at_paths;
}
public Integer getDefault_page_size() { public Integer getDefault_page_size() {
return default_page_size; return default_page_size;
} }
@@ -746,11 +767,13 @@ public class AppProperties {
this.tester = tester; this.tester = tester;
} }
public Boolean getNarrative_enabled() { public Boolean getNarrative_enabled()
{
return narrative_enabled; return narrative_enabled;
} }
public void setNarrative_enabled(Boolean narrative_enabled) { public void setNarrative_enabled(Boolean narrative_enabled)
{
this.narrative_enabled = narrative_enabled; this.narrative_enabled = narrative_enabled;
} }
@@ -810,13 +833,13 @@ public class AppProperties {
this.bundle_batch_pool_max_size = bundle_batch_pool_max_size; this.bundle_batch_pool_max_size = bundle_batch_pool_max_size;
} }
public List<String> getLocal_base_urls() { public Set<String> getLocal_base_urls() {
return local_base_urls; return local_base_urls;
} }
public static class Cors { public static class Cors {
private Boolean allow_Credentials = true; private Boolean allow_Credentials = true;
private List<String> allowed_origin = ImmutableList.of("*"); private List<String> allowed_origin = List.of("*");
public List<String> getAllowed_origin() { public List<String> getAllowed_origin() {
return allowed_origin; return allowed_origin;
@@ -834,6 +857,7 @@ public class AppProperties {
this.allow_Credentials = allow_Credentials; this.allow_Credentials = allow_Credentials;
} }
} }
public static class Logger { public static class Logger {
@@ -876,6 +900,7 @@ public class AppProperties {
} }
} }
public static class Tester { public static class Tester {
private String name; private String name;
@@ -916,35 +941,6 @@ public class AppProperties {
} }
} }
public static class ImplementationGuide {
private String url;
private String name;
private String version;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}
public static class Validation { public static class Validation {
@@ -980,7 +976,6 @@ public class AppProperties {
public void setPartitioning_include_in_search_hashes(Boolean partitioning_include_in_search_hashes) { public void setPartitioning_include_in_search_hashes(Boolean partitioning_include_in_search_hashes) {
this.partitioning_include_in_search_hashes = partitioning_include_in_search_hashes; this.partitioning_include_in_search_hashes = partitioning_include_in_search_hashes;
} }
public Boolean getAllow_references_across_partitions() { public Boolean getAllow_references_across_partitions() {
return allow_references_across_partitions; return allow_references_across_partitions;
} }
@@ -1020,6 +1015,7 @@ public class AppProperties {
this.email = email; this.email = email;
} }
public static class Email { public static class Email {
public String getFrom() { public String getFrom() {
return from; return from;

View File

@@ -1,6 +1,5 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
@@ -14,25 +13,37 @@ import java.net.URI;
@ConditionalOnProperty(prefix = "hapi.fhir", name = "staticLocation") @ConditionalOnProperty(prefix = "hapi.fhir", name = "staticLocation")
public class ExtraStaticFilesConfigurer implements WebMvcConfigurer { public class ExtraStaticFilesConfigurer implements WebMvcConfigurer {
public static final String ROOT_CONTEXT_PATH = "/static"; private String staticLocation;
@Autowired private String rootContextPath;
AppProperties appProperties;
public ExtraStaticFilesConfigurer(AppProperties appProperties) {
rootContextPath = appProperties.getStaticLocationPrefix();
if(rootContextPath.endsWith("/"))
rootContextPath = rootContextPath.substring(0, rootContextPath.lastIndexOf('/'));
staticLocation = appProperties.getStaticLocation();
if(staticLocation.endsWith("/"))
staticLocation = staticLocation.substring(0, staticLocation.lastIndexOf('/'));
}
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry theRegistry) { public void addResourceHandlers(ResourceHandlerRegistry theRegistry) {
theRegistry.addResourceHandler(ROOT_CONTEXT_PATH + "/**").addResourceLocations(appProperties.getStaticLocation()); theRegistry.addResourceHandler(rootContextPath + "/**").addResourceLocations(staticLocation);
} }
@Override @Override
public void addViewControllers(ViewControllerRegistry registry) { public void addViewControllers(ViewControllerRegistry registry) {
String path = URI.create(appProperties.getStaticLocation()).getPath(); String path = URI.create(staticLocation).getPath();
String lastSegment = path.substring(path.lastIndexOf('/') + 1); String lastSegment = path.substring(path.lastIndexOf('/') + 1);
registry.addViewController(ROOT_CONTEXT_PATH).setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); registry.addViewController(rootContextPath).setViewName("redirect:" + rootContextPath + "/" + lastSegment + "/index.html");
registry.addViewController(ROOT_CONTEXT_PATH + "/*").setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); registry.addViewController(rootContextPath + "/*").setViewName("redirect:" + rootContextPath + "/" + lastSegment + "/index.html");
registry.addViewController(ROOT_CONTEXT_PATH + "/" + lastSegment + "/").setViewName("redirect:" + ROOT_CONTEXT_PATH + "/" + lastSegment + "/index.html"); registry.addViewController(rootContextPath + "/" + lastSegment + "/").setViewName("redirect:" + rootContextPath + "/" + lastSegment + "/index.html");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE); registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
} }

View File

@@ -29,7 +29,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import java.util.HashSet; import java.util.HashSet;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -42,22 +41,15 @@ public class FhirServerConfigCommon {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
public FhirServerConfigCommon(AppProperties appProperties) { public FhirServerConfigCommon(AppProperties appProperties) {
ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny") ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny") + " contains searches");
+ " contains searches"); ourLog.info("Server configured to " + (appProperties.getAllow_multiple_delete() ? "allow" : "deny") + " multiple deletes");
ourLog.info("Server configured to " + (appProperties.getAllow_multiple_delete() ? "allow" : "deny") ourLog.info("Server configured to " + (appProperties.getAllow_external_references() ? "allow" : "deny") + " external references");
+ " multiple deletes"); ourLog.info("Server configured to " + (appProperties.getDao_scheduling_enabled() ? "enable" : "disable") + " DAO scheduling");
ourLog.info("Server configured to " + (appProperties.getAllow_external_references() ? "allow" : "deny") ourLog.info("Server configured to " + (appProperties.getDelete_expunge_enabled() ? "enable" : "disable") + " delete expunges");
+ " external references");
ourLog.info("Server configured to " + (appProperties.getDao_scheduling_enabled() ? "enable" : "disable")
+ " DAO scheduling");
ourLog.info("Server configured to " + (appProperties.getDelete_expunge_enabled() ? "enable" : "disable")
+ " delete expunges");
ourLog.info("Server configured to " + (appProperties.getExpunge_enabled() ? "enable" : "disable") + " expunges"); ourLog.info("Server configured to " + (appProperties.getExpunge_enabled() ? "enable" : "disable") + " expunges");
ourLog.info("Server configured to " + (appProperties.getAllow_override_default_search_params() ? "allow" : "deny") ourLog.info("Server configured to " + (appProperties.getAllow_override_default_search_params() ? "allow" : "deny") + " overriding default search params");
+ " overriding default search params"); ourLog.info("Server configured to " + (appProperties.getAuto_create_placeholder_reference_targets() ? "allow" : "disable") + " auto-creating placeholder references");
ourLog.info("Server configured to " ourLog.info("Server configured to auto-version references at paths {}", appProperties.getAuto_version_reference_at_paths());
+ (appProperties.getAuto_create_placeholder_reference_targets() ? "allow" : "disable")
+ " auto-creating placeholder references");
if (appProperties.getSubscription().getEmail() != null) { if (appProperties.getSubscription().getEmail() != null) {
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail(); AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
@@ -94,22 +86,18 @@ public class FhirServerConfigCommon {
public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) { public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
JpaStorageSettings jpaStorageSettings = new JpaStorageSettings(); JpaStorageSettings jpaStorageSettings = new JpaStorageSettings();
jpaStorageSettings.setIndexMissingFields( jpaStorageSettings.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? StorageSettings.IndexEnabledEnum.ENABLED : StorageSettings.IndexEnabledEnum.DISABLED);
appProperties.getEnable_index_missing_fields() ? JpaStorageSettings.IndexEnabledEnum.ENABLED jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
: JpaStorageSettings.IndexEnabledEnum.DISABLED); jpaStorageSettings.setAutoVersionReferenceAtPaths(appProperties.getAuto_version_reference_at_paths());
jpaStorageSettings jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets()); jpaStorageSettings.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
jpaStorageSettings
.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
jpaStorageSettings
.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
jpaStorageSettings.setAllowContainsSearches(appProperties.getAllow_contains_searches()); jpaStorageSettings.setAllowContainsSearches(appProperties.getAllow_contains_searches());
jpaStorageSettings.setAllowMultipleDelete(appProperties.getAllow_multiple_delete()); jpaStorageSettings.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references()); jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
jpaStorageSettings.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled()); jpaStorageSettings.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled());
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled()); jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled()); jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) if(appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null)
jpaStorageSettings.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom()); jpaStorageSettings.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom());
Integer maxFetchSize = appProperties.getMax_page_size(); Integer maxFetchSize = appProperties.getMax_page_size();

View File

@@ -4,6 +4,7 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.to.FhirTesterMvcConfig; import ca.uhn.fhir.to.FhirTesterMvcConfig;
import ca.uhn.fhir.to.TesterConfig; import ca.uhn.fhir.to.TesterConfig;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@@ -18,6 +19,7 @@ import org.springframework.context.annotation.Import;
*/ */
@Configuration @Configuration
@Import(FhirTesterMvcConfig.class) @Import(FhirTesterMvcConfig.class)
@Conditional(FhirTesterConfigCondition.class)
public class FhirTesterConfig { public class FhirTesterConfig {
/** /**
@@ -26,7 +28,7 @@ public class FhirTesterConfig {
* server, as well as one public server. If you are creating a project to * server, as well as one public server. If you are creating a project to
* deploy somewhere else, you might choose to only put your own server's * deploy somewhere else, you might choose to only put your own server's
* address here. * address here.
* * <p>
* Note the use of the ${serverBase} variable below. This will be replaced with * Note the use of the ${serverBase} variable below. This will be replaced with
* the base URL as reported by the server itself. Often for a simple Tomcat * the base URL as reported by the server itself. Often for a simple Tomcat
* (or other container) installation, this will end up being something * (or other container) installation, this will end up being something

View File

@@ -0,0 +1,16 @@
package ca.uhn.fhir.jpa.starter.common;
import ca.uhn.fhir.jpa.starter.util.EnvironmentHelper;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class FhirTesterConfigCondition implements Condition {
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata metadata) {
var properties = EnvironmentHelper.getPropertiesStartingWith((ConfigurableEnvironment) conditionContext.getEnvironment(), "hapi.fhir.tester");
return !properties.isEmpty();
}
}

View File

@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.starter.common; package ca.uhn.fhir.jpa.starter.common;
import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry;
import ca.uhn.fhir.batch2.jobs.export.BulkDataExportProvider;
import ca.uhn.fhir.batch2.jobs.imprt.BulkDataImportProvider; import ca.uhn.fhir.batch2.jobs.imprt.BulkDataImportProvider;
import ca.uhn.fhir.batch2.jobs.reindex.ReindexJobParameters; import ca.uhn.fhir.batch2.jobs.reindex.ReindexJobParameters;
import ca.uhn.fhir.batch2.jobs.reindex.ReindexProvider; import ca.uhn.fhir.batch2.jobs.reindex.ReindexProvider;
@@ -10,6 +9,7 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.api.IDaoRegistry; import ca.uhn.fhir.jpa.api.IDaoRegistry;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
@@ -18,6 +18,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider;
import ca.uhn.fhir.batch2.jobs.export.BulkDataExportProvider;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil; import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil;
import ca.uhn.fhir.jpa.config.util.ValidationSupportConfigUtil; import ca.uhn.fhir.jpa.config.util.ValidationSupportConfigUtil;
@@ -60,7 +61,6 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport; import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -73,26 +73,23 @@ import org.springframework.http.HttpHeaders;
import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import javax.persistence.EntityManagerFactory; import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.*; import java.util.*;
import static ca.uhn.fhir.context.FhirVersionEnum.DSTU3;
import static ca.uhn.fhir.context.FhirVersionEnum.R4;
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR; import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
@Configuration @Configuration
// allow users to configure custom packages to scan for additional beans //allow users to configure custom packages to scan for additional beans
@ComponentScan(basePackages = { "${hapi.fhir.custom-bean-packages:}" }) @ComponentScan(basePackages = { "${hapi.fhir.custom-bean-packages:}" })
@Import({ ThreadPoolFactoryConfig.class }) @Import(
ThreadPoolFactoryConfig.class
)
public class StarterJpaConfig { public class StarterJpaConfig {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StarterJpaConfig.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StarterJpaConfig.class);
public StarterJpaConfig() {
}
@Bean @Bean
public IFulltextSearchSvc fullTextSearchSvc() { public IFulltextSearchSvc fullTextSearchSvc() {
return new FulltextSearchSvcImpl(); return new FulltextSearchSvcImpl();
@@ -109,12 +106,14 @@ public class StarterJpaConfig {
return ValidationSupportConfigUtil.newCachingValidationSupport(theJpaValidationSupportChain); return ValidationSupportConfigUtil.newCachingValidationSupport(theJpaValidationSupportChain);
} }
@Autowired @Autowired
private ConfigurableEnvironment configurableEnvironment; private ConfigurableEnvironment configurableEnvironment;
/** /**
* Customize the default/max page sizes for search results. You can set these * Customize the default/max page sizes for search results. You can set these however
* however
* you want, although very large page sizes will require a lot of RAM. * you want, although very large page sizes will require a lot of RAM.
*/ */
@Bean @Bean
@@ -125,6 +124,7 @@ public class StarterJpaConfig {
return pagingProvider; return pagingProvider;
} }
@Bean @Bean
public IResourceSupportedSvc resourceSupportedSvc(IDaoRegistry theDaoRegistry) { public IResourceSupportedSvc resourceSupportedSvc(IDaoRegistry theDaoRegistry) {
return new DaoRegistryResourceSupportedSvc(theDaoRegistry); return new DaoRegistryResourceSupportedSvc(theDaoRegistry);
@@ -137,10 +137,8 @@ public class StarterJpaConfig {
@Primary @Primary
@Bean @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource myDataSource, public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource myDataSource, ConfigurableListableBeanFactory myConfigurableListableBeanFactory, FhirContext theFhirContext) {
ConfigurableListableBeanFactory myConfigurableListableBeanFactory, FhirContext theFhirContext) { LocalContainerEntityManagerFactoryBean retVal = HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext);
LocalContainerEntityManagerFactoryBean retVal = HapiEntityManagerFactoryUtil
.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext);
retVal.setPersistenceUnitName("HAPI_PU"); retVal.setPersistenceUnitName("HAPI_PU");
try { try {
@@ -148,8 +146,7 @@ public class StarterJpaConfig {
} catch (Exception e) { } catch (Exception e) {
throw new ConfigurationException("Could not set the data source due to a configuration issue", e); throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
} }
retVal.setJpaProperties( retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment, myConfigurableListableBeanFactory));
EnvironmentHelper.getHibernateProperties(configurableEnvironment, myConfigurableListableBeanFactory));
return retVal; return retVal;
} }
@@ -166,10 +163,10 @@ public class StarterJpaConfig {
return new HSearchSortHelperImpl(mySearchParamRegistry); return new HSearchSortHelperImpl(mySearchParamRegistry);
} }
@Bean @Bean
@ConditionalOnProperty(prefix = "hapi.fhir", name = ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR, havingValue = "true") @ConditionalOnProperty(prefix = "hapi.fhir", name = ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR, havingValue = "true")
public RepositoryValidatingInterceptor repositoryValidatingInterceptor( public RepositoryValidatingInterceptor repositoryValidatingInterceptor(IRepositoryValidationInterceptorFactory factory) {
IRepositoryValidationInterceptorFactory factory) {
return factory.buildUsingStoredStructureDefinitions(); return factory.buildUsingStoredStructureDefinitions();
} }
@@ -191,23 +188,20 @@ public class StarterJpaConfig {
@Bean("packageInstaller") @Bean("packageInstaller")
@Primary @Primary
@Conditional(OnImplementationGuidesPresent.class) @Conditional(OnImplementationGuidesPresent.class)
public IPackageInstallerSvc packageInstaller(AppProperties appProperties, public IPackageInstallerSvc packageInstaller(AppProperties appProperties, JobDefinition<ReindexJobParameters> reindexJobParametersJobDefinition, JobDefinitionRegistry jobDefinitionRegistry, IPackageInstallerSvc packageInstallerSvc)
JobDefinition<ReindexJobParameters> reindexJobParametersJobDefinition, {
JobDefinitionRegistry jobDefinitionRegistry, IPackageInstallerSvc packageInstallerSvc) {
jobDefinitionRegistry.addJobDefinitionIfNotRegistered(reindexJobParametersJobDefinition); jobDefinitionRegistry.addJobDefinitionIfNotRegistered(reindexJobParametersJobDefinition);
if (appProperties.getImplementationGuides() != null) { if (appProperties.getImplementationGuides() != null) {
Map<String, AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides(); Map<String, PackageInstallationSpec> guides = appProperties.getImplementationGuides();
for (Map.Entry<String, AppProperties.ImplementationGuide> guide : guides.entrySet()) { for (Map.Entry<String, PackageInstallationSpec> guidesEntry : guides.entrySet()) {
PackageInstallationSpec packageInstallationSpec = new PackageInstallationSpec() PackageInstallationSpec packageInstallationSpec = guidesEntry.getValue();
.setPackageUrl(guide.getValue().getUrl()).setName(guide.getValue().getName())
.setVersion(guide.getValue().getVersion())
.setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL);
packageInstallationSpec.setReloadExisting(appProperties.getReload_existing_implementationguides());
if (appProperties.getInstall_transitive_ig_dependencies()) { if (appProperties.getInstall_transitive_ig_dependencies()) {
packageInstallationSpec.setFetchDependencies(true);
packageInstallationSpec.setDependencyExcludes( packageInstallationSpec.addDependencyExclude("hl7.fhir.r2.core")
ImmutableList.of("hl7.fhir.r2.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r5.core")); .addDependencyExclude("hl7.fhir.r3.core")
.addDependencyExclude("hl7.fhir.r4.core")
.addDependencyExclude("hl7.fhir.r5.core");
} }
packageInstallerSvc.install(packageInstallationSpec); packageInstallerSvc.install(packageInstallationSpec);
} }
@@ -247,24 +241,7 @@ public class StarterJpaConfig {
} }
@Bean @Bean
public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, JpaStorageSettings jpaStorageSettings, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional<TerminologyUploaderProvider> terminologyUploaderProvider, Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider, Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, Optional<IpsOperationProvider> theIpsOperationProvider) {
DaoRegistry daoRegistry,
Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider,
ResourceProviderFactory resourceProviderFactory, JpaStorageSettings jpaStorageSettings,
ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport,
DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor,
Optional<TerminologyUploaderProvider> terminologyUploaderProvider,
Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider,
Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster,
Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor,
IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider,
BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider,
ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider,
PartitionManagementProvider partitionManagementProvider,
Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor,
IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc,
ApplicationContext appContext,
Optional<IpsOperationProvider> theIpsOperationProvider) {
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext()); RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
List<String> supportedResourceTypes = appProperties.getSupported_resource_types(); List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
@@ -282,21 +259,18 @@ public class StarterJpaConfig {
fhirSystemDao.getContext().setNarrativeGenerator(new NullNarrativeGenerator()); fhirSystemDao.getContext().setNarrativeGenerator(new NullNarrativeGenerator());
} }
if (appProperties.getMdm_enabled()) { if (appProperties.getMdm_enabled()) mdmProviderProvider.get().loadProvider();
mdmProviderProvider.get().loadProvider();
}
fhirServer.registerProviders(resourceProviderFactory.createProviders()); fhirServer.registerProviders(resourceProviderFactory.createProviders());
fhirServer.registerProvider(jpaSystemProvider); fhirServer.registerProvider(jpaSystemProvider);
fhirServer.setServerConformanceProvider(calculateConformanceProvider(fhirSystemDao, fhirServer, fhirServer.setServerConformanceProvider(calculateConformanceProvider(fhirSystemDao, fhirServer, jpaStorageSettings, searchParamRegistry, theValidationSupport));
jpaStorageSettings, searchParamRegistry, theValidationSupport));
/* /*
* ETag Support * ETag Support
*/ */
if (!appProperties.getEtag_support_enabled()) if (!appProperties.getEtag_support_enabled()) fhirServer.setETagSupport(ETagSupportEnum.DISABLED);
fhirServer.setETagSupport(ETagSupportEnum.DISABLED);
/* /*
* Default to JSON and pretty printing * Default to JSON and pretty printing
@@ -333,8 +307,7 @@ public class StarterJpaConfig {
/* /*
* If you are hosting this server at a specific DNS name, the server will try to * If you are hosting this server at a specific DNS name, the server will try to
* figure out the FHIR base URL based on what the web container tells it, but * figure out the FHIR base URL based on what the web container tells it, but
* this doesn't always work. If you are setting links in your search bundles * this doesn't always work. If you are setting links in your search bundles that
* that
* just refer to "localhost", you might want to use a server address strategy: * just refer to "localhost", you might want to use a server address strategy:
*/ */
String serverAddress = appProperties.getServer_address(); String serverAddress = appProperties.getServer_address();
@@ -342,24 +315,19 @@ public class StarterJpaConfig {
fhirServer.setServerAddressStrategy(new HardcodedServerAddressStrategy(serverAddress)); fhirServer.setServerAddressStrategy(new HardcodedServerAddressStrategy(serverAddress));
} else if (appProperties.getUse_apache_address_strategy()) { } else if (appProperties.getUse_apache_address_strategy()) {
boolean useHttps = appProperties.getUse_apache_address_strategy_https(); boolean useHttps = appProperties.getUse_apache_address_strategy_https();
fhirServer.setServerAddressStrategy( fhirServer.setServerAddressStrategy(useHttps ? ApacheProxyAddressStrategy.forHttps() : ApacheProxyAddressStrategy.forHttp());
useHttps ? ApacheProxyAddressStrategy.forHttps() : ApacheProxyAddressStrategy.forHttp());
} else { } else {
fhirServer.setServerAddressStrategy(new IncomingRequestAddressStrategy()); fhirServer.setServerAddressStrategy(new IncomingRequestAddressStrategy());
} }
/* /*
* If you are using DSTU3+, you may want to add a terminology uploader, which * If you are using DSTU3+, you may want to add a terminology uploader, which allows
* allows * uploading of external terminologies such as Snomed CT. Note that this uploader
* uploading of external terminologies such as Snomed CT. Note that this * does not have any security attached (any anonymous user may use it by default)
* uploader * so it is a potential security vulnerability. Consider using an AuthorizationInterceptor
* does not have any security attached (any anonymous user may use it by
* default)
* so it is a potential security vulnerability. Consider using an
* AuthorizationInterceptor
* with this feature. * with this feature.
*/ */
if (fhirSystemDao.getContext().getVersion().getVersion().isEqualOrNewerThan(DSTU3)) { // <-- ENABLED RIGHT NOW if (fhirSystemDao.getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) { // <-- ENABLED RIGHT NOW
fhirServer.registerProvider(terminologyUploaderProvider.get()); fhirServer.registerProvider(terminologyUploaderProvider.get());
} }
@@ -377,8 +345,7 @@ public class StarterJpaConfig {
} }
if (appProperties.getAllow_cascading_deletes()) { if (appProperties.getAllow_cascading_deletes()) {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor( CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(fhirSystemDao.getContext(), daoRegistry, interceptorBroadcaster, theThreadSafeResourceDeleterSvc);
fhirSystemDao.getContext(), daoRegistry, interceptorBroadcaster, theThreadSafeResourceDeleterSvc);
fhirServer.registerInterceptor(cascadingDeleteInterceptor); fhirServer.registerInterceptor(cascadingDeleteInterceptor);
} }
@@ -407,7 +374,7 @@ public class StarterJpaConfig {
// GraphQL // GraphQL
if (appProperties.getGraphql_enabled()) { if (appProperties.getGraphql_enabled()) {
if (fhirSystemDao.getContext().getVersion().getVersion().isEqualOrNewerThan(DSTU3)) { if (fhirSystemDao.getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
fhirServer.registerProvider(graphQLProvider.get()); fhirServer.registerProvider(graphQLProvider.get());
} }
} }
@@ -421,15 +388,16 @@ public class StarterJpaConfig {
fhirServer.registerProvider(bulkDataExportProvider); fhirServer.registerProvider(bulkDataExportProvider);
} }
// Bulk Import //Bulk Import
if (appProperties.getBulk_import_enabled()) { if (appProperties.getBulk_import_enabled()) {
fhirServer.registerProvider(bulkDataImportProvider); fhirServer.registerProvider(bulkDataImportProvider);
} }
// valueSet Operations i.e $expand // valueSet Operations i.e $expand
fhirServer.registerProvider(theValueSetOperationProvider); fhirServer.registerProvider(theValueSetOperationProvider);
// reindex Provider $reindex //reindex Provider $reindex
fhirServer.registerProvider(reindexProvider); fhirServer.registerProvider(reindexProvider);
// Partitioning // Partitioning
@@ -443,7 +411,8 @@ public class StarterJpaConfig {
// register custom interceptors // register custom interceptors
registerCustomInterceptors(fhirServer, appContext, appProperties.getCustomInterceptorClasses()); registerCustomInterceptors(fhirServer, appContext, appProperties.getCustomInterceptorClasses());
// register the IPS Provider
//register the IPS Provider
if (!theIpsOperationProvider.isEmpty()) { if (!theIpsOperationProvider.isEmpty()) {
fhirServer.registerProvider(theIpsOperationProvider.get()); fhirServer.registerProvider(theIpsOperationProvider.get());
} }
@@ -455,8 +424,7 @@ public class StarterJpaConfig {
* check the properties for custom interceptor classes and registers them. * check the properties for custom interceptor classes and registers them.
*/ */
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
private void registerCustomInterceptors(RestfulServer fhirServer, ApplicationContext theAppContext, private void registerCustomInterceptors(RestfulServer fhirServer, ApplicationContext theAppContext, List<String> customInterceptorClasses) {
List<String> customInterceptorClasses) {
if (customInterceptorClasses == null) { if (customInterceptorClasses == null) {
return; return;
@@ -490,37 +458,30 @@ public class StarterJpaConfig {
} }
} }
public static IServerConformanceProvider<?> calculateConformanceProvider(IFhirSystemDao fhirSystemDao, public static IServerConformanceProvider<?> calculateConformanceProvider(IFhirSystemDao fhirSystemDao, RestfulServer fhirServer, JpaStorageSettings jpaStorageSettings, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport) {
RestfulServer fhirServer, JpaStorageSettings jpaStorageSettings, ISearchParamRegistry searchParamRegistry,
IValidationSupport theValidationSupport) {
FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion(); FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
if (fhirVersion == FhirVersionEnum.DSTU2) { if (fhirVersion == FhirVersionEnum.DSTU2) {
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(fhirServer, fhirSystemDao, JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(fhirServer, fhirSystemDao, jpaStorageSettings);
jpaStorageSettings);
confProvider.setImplementationDescription("HAPI FHIR DSTU2 Server"); confProvider.setImplementationDescription("HAPI FHIR DSTU2 Server");
return confProvider; return confProvider;
} else if (fhirVersion == DSTU3) { } else if (fhirVersion == FhirVersionEnum.DSTU3) {
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(fhirServer, fhirSystemDao, JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry);
jpaStorageSettings, searchParamRegistry);
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server"); confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
return confProvider; return confProvider;
} else if (fhirVersion == R4) { } else if (fhirVersion == FhirVersionEnum.R4) {
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
jpaStorageSettings, searchParamRegistry, theValidationSupport);
confProvider.setImplementationDescription("HAPI FHIR R4 Server"); confProvider.setImplementationDescription("HAPI FHIR R4 Server");
return confProvider; return confProvider;
} else if (fhirVersion == FhirVersionEnum.R4B) { } else if (fhirVersion == FhirVersionEnum.R4B) {
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
jpaStorageSettings, searchParamRegistry, theValidationSupport);
confProvider.setImplementationDescription("HAPI FHIR R4B Server"); confProvider.setImplementationDescription("HAPI FHIR R4B Server");
return confProvider; return confProvider;
} else if (fhirVersion == FhirVersionEnum.R5) { } else if (fhirVersion == FhirVersionEnum.R5) {
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
jpaStorageSettings, searchParamRegistry, theValidationSupport);
confProvider.setImplementationDescription("HAPI FHIR R5 Server"); confProvider.setImplementationDescription("HAPI FHIR R5 Server");
return confProvider; return confProvider;
} else { } else {

View File

@@ -47,12 +47,12 @@ public class RepositoryValidationInterceptorFactoryDstu3 implements IRepositoryV
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() { public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap().add(StructureDefinition.SP_KIND, new TokenParam("resource"))); IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap().add(StructureDefinition.SP_KIND, new TokenParam("resource")));
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()) Map<String, List<StructureDefinition>> structureDefinitions = results.getResources(0, results.size())
.stream() .stream()
.map(StructureDefinition.class::cast) .map(StructureDefinition.class::cast)
.collect(Collectors.groupingBy(StructureDefinition::getType)); .collect(Collectors.groupingBy(StructureDefinition::getType));
structureDefintions.forEach((key, value) -> { structureDefinitions.forEach((key, value) -> {
String[] urls = value.stream().map(StructureDefinition::getUrl).toArray(String[]::new); String[] urls = value.stream().map(StructureDefinition::getUrl).toArray(String[]::new);
repositoryValidatingRuleBuilder.forResourcesOfType(key).requireAtLeastOneProfileOf(urls).and().requireValidationToDeclaredProfiles(); repositoryValidatingRuleBuilder.forResourcesOfType(key).requireAtLeastOneProfileOf(urls).and().requireValidationToDeclaredProfiles();
}); });

View File

@@ -1,14 +1,16 @@
package ca.uhn.fhir.jpa.starter.cr; package ca.uhn.fhir.jpa.starter.cr;
import ca.uhn.fhir.cr.config.r4.CrR4Config;
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Import;
import ca.uhn.fhir.cr.common.CqlThreadFactory; import ca.uhn.fhir.cr.common.CqlThreadFactory;
import ca.uhn.fhir.cr.config.ApplyOperationConfig; import ca.uhn.fhir.cr.config.ApplyOperationConfig;
import ca.uhn.fhir.cr.config.ExtractOperationConfig; import ca.uhn.fhir.cr.config.ExtractOperationConfig;
import ca.uhn.fhir.cr.config.PackageOperationConfig; import ca.uhn.fhir.cr.config.PackageOperationConfig;
import ca.uhn.fhir.cr.config.PopulateOperationConfig; import ca.uhn.fhir.cr.config.PopulateOperationConfig;
import ca.uhn.fhir.cr.config.r4.CrR4Config;
import ca.uhn.fhir.jpa.starter.AppProperties; import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
import org.cqframework.cql.cql2elm.CqlCompilerOptions; import org.cqframework.cql.cql2elm.CqlCompilerOptions;
import org.cqframework.cql.cql2elm.model.CompiledLibrary; import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.cqframework.cql.cql2elm.model.Model; import org.cqframework.cql.cql2elm.model.Model;
@@ -29,7 +31,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.function.Function;
@Configuration @Configuration
@Conditional({ OnR4Condition.class, CrConfigCondition.class }) @Conditional({ OnR4Condition.class, CrConfigCondition.class })

View File

@@ -15,18 +15,18 @@ import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl;
@Conditional(IpsConfigCondition.class) @Conditional(IpsConfigCondition.class)
public class StarterIpsConfig { public class StarterIpsConfig {
@Bean @Bean
IIpsGenerationStrategy IpsGenerationStrategy() IIpsGenerationStrategy ipsGenerationStrategy()
{ {
return new DefaultIpsGenerationStrategy(); return new DefaultIpsGenerationStrategy();
} }
@Bean @Bean
public IpsOperationProvider IpsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){ public IpsOperationProvider ipsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){
return new IpsOperationProvider(theIpsGeneratorSvc); return new IpsOperationProvider(theIpsGeneratorSvc);
} }
@Bean @Bean
public IIpsGeneratorSvc IpsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry) public IIpsGeneratorSvc ipsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry)
{ {
return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry); return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry);
} }

View File

@@ -6,7 +6,6 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator; import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
import ca.uhn.fhir.mdm.rules.config.MdmSettings; import ca.uhn.fhir.mdm.rules.config.MdmSettings;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@@ -17,6 +16,7 @@ import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
@Configuration @Configuration
@Conditional(MdmConfigCondition.class) @Conditional(MdmConfigCondition.class)
@@ -27,7 +27,7 @@ public class MdmConfig {
IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) throws IOException { IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("mdm-rules.json"); Resource resource = resourceLoader.getResource("mdm-rules.json");
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); String json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8);
return new MdmSettings(theMdmRuleValidator).setEnabled(appProperties.getMdm_enabled()).setScriptText(json); return new MdmSettings(theMdmRuleValidator).setEnabled(appProperties.getMdm_enabled()).setScriptText(json);
} }
} }

View File

@@ -17,7 +17,6 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings;
import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy; import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
import org.springframework.core.env.CompositePropertySource; import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.EnumerablePropertySource;

View File

@@ -68,7 +68,8 @@ hapi:
### forces the use of the https:// protocol for the returned server address. ### forces the use of the https:// protocol for the returned server address.
### alternatively, it may be set using the X-Forwarded-Proto header. ### alternatively, it may be set using the X-Forwarded-Proto header.
# use_apache_address_strategy_https: false # use_apache_address_strategy_https: false
### enables the server to host content like HTML, css, etc. under the url pattern of /static/** ### enables the server to host content like HTML, css, etc. under the url pattern of eg. /static/**
# staticLocationPrefix: /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/** ### 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 #staticLocation: file:/foo/bar/bazz
### enable to set the Server URL ### enable to set the Server URL
@@ -77,14 +78,15 @@ hapi:
# install_transitive_ig_dependencies: true # install_transitive_ig_dependencies: true
### tells the server whether to attempt to load IG resources that are already present ### tells the server whether to attempt to load IG resources that are already present
# reload_existing_implementationGuides : false # reload_existing_implementationGuides : false
# implementationguides: #implementationguides:
### example from registry (packages.fhir.org) ### example from registry (packages.fhir.org)
# swiss: # swiss:
# name: swiss.mednet.fhir # name: swiss.mednet.fhir
# version: 0.8.0 # version: 0.8.0
# reloadExisting : false
# example not from registry # example not from registry
# ips_1_0_0: # ips_1_0_0:
# url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz # packageUrl: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz
# name: hl7.fhir.uv.ips # name: hl7.fhir.uv.ips
# version: 1.0.0 # version: 1.0.0
# supported_resource_types: # supported_resource_types:
@@ -100,6 +102,8 @@ hapi:
# allow_multiple_delete: true # allow_multiple_delete: true
# allow_override_default_search_params: true # allow_override_default_search_params: true
# auto_create_placeholder_reference_targets: false # auto_create_placeholder_reference_targets: false
### tells the server to automatically append the current version of the target resource to references at these paths
# auto_version_reference_at_paths: Device.patient, Device.location, Device.parent, DeviceMetric.parent, DeviceMetric.source, Observation.device, Observation.subject
# cr_enabled: true # cr_enabled: true
# ips_enabled: false # ips_enabled: false
# default_encoding: JSON # default_encoding: JSON

View File

@@ -15,7 +15,7 @@ import org.springframework.boot.test.context.SpringBootTest;
"hapi.fhir.subscription.websocket_enabled=false", "hapi.fhir.subscription.websocket_enabled=false",
"spring.main.allow-bean-definition-overriding=true" "spring.main.allow-bean-definition-overriding=true"
}) })
public class CustomBeanTest { class CustomBeanTest {
@Autowired @Autowired
some.custom.pkg1.CustomBean customBean1; some.custom.pkg1.CustomBean customBean1;

View File

@@ -22,7 +22,7 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
"hapi.fhir.fhir_version=r4" "hapi.fhir.fhir_version=r4"
}) })
public class CustomInterceptorTest { class CustomInterceptorTest {
@LocalServerPort @LocalServerPort
private int port; private int port;

View File

@@ -3,16 +3,23 @@ package ca.uhn.fhir.jpa.starter;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl; import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
import ca.uhn.fhir.jpa.test.config.TestElasticsearchContainerHelper;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import java.io.IOException; import java.io.IOException;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
import org.elasticsearch.common.settings.Settings;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.DateTimeType; import org.hl7.fhir.r4.model.DateTimeType;
@@ -34,8 +41,11 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.testcontainers.elasticsearch.ElasticsearchContainer; import org.testcontainers.elasticsearch.ElasticsearchContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@Testcontainers
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties =
{ {
"spring.datasource.url=jdbc:h2:mem:dbr4", "spring.datasource.url=jdbc:h2:mem:dbr4",
@@ -43,6 +53,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
"hapi.fhir.lastn_enabled=true", "hapi.fhir.lastn_enabled=true",
"hapi.fhir.store_resource_in_lucene_index_enabled=true", "hapi.fhir.store_resource_in_lucene_index_enabled=true",
"hapi.fhir.advanced_lucene_indexing=true", "hapi.fhir.advanced_lucene_indexing=true",
"elasticsearch.enabled=true", "elasticsearch.enabled=true",
"hapi.fhir.cr_enabled=false", "hapi.fhir.cr_enabled=false",
// Because the port is set randomly, we will set the rest_url using the Initializer. // Because the port is set randomly, we will set the rest_url using the Initializer.
@@ -62,17 +73,29 @@ public class ElasticsearchLastNR4IT {
private IGenericClient ourClient; private IGenericClient ourClient;
private FhirContext ourCtx; private FhirContext ourCtx;
private static final String ELASTIC_VERSION = "7.16.3"; @Container
private static final String ELASTIC_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch:" + ELASTIC_VERSION; public static ElasticsearchContainer embeddedElastic = TestElasticsearchContainerHelper.getEmbeddedElasticSearch();
private static ElasticsearchContainer embeddedElastic;
@Autowired @Autowired
private ElasticsearchSvcImpl myElasticsearchSvc; private ElasticsearchSvcImpl myElasticsearchSvc;
@BeforeAll @BeforeAll
public static void beforeClass() { public static void beforeClass() throws IOException {
embeddedElastic = new ElasticsearchContainer(ELASTIC_IMAGE).withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS)); //Given
embeddedElastic.start(); RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
"http", embeddedElastic.getHost() + ":" + embeddedElastic.getMappedPort(9200), "", "");
/* As of 2023-08-10, HAPI FHIR sets SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS to 50000
which is in excess of elastic's default max_result_window. If MAX_SUBSCRIPTION_RESULTS is changed
to a value <= 10000, the following will no longer be necessary. - dotasek
*/
PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest("hapi_fhir_template");
putIndexTemplateRequest.patterns(List.of("*"));
Settings settings = Settings.builder().put("index.max_result_window", 50000).build();
putIndexTemplateRequest.settings(settings);
elasticsearchHighLevelRestClient.indices().putTemplate(putIndexTemplateRequest, RequestOptions.DEFAULT);
} }
@PreDestroy @PreDestroy
@@ -116,7 +139,7 @@ public class ElasticsearchLastNR4IT {
} }
@BeforeEach @BeforeEach
void beforeEach() { void beforeEach() throws IOException {
ourCtx = FhirContext.forR4(); ourCtx = FhirContext.forR4();
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
@@ -124,6 +147,7 @@ public class ElasticsearchLastNR4IT {
String ourServerBase = "http://localhost:" + port + "/fhir/"; String ourServerBase = "http://localhost:" + port + "/fhir/";
ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true)); ourClient.registerInterceptor(new LoggingInterceptor(true));
} }
static class Initializer static class Initializer

View File

@@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
"spring.datasource.url=jdbc:h2:mem:dbr2", "spring.datasource.url=jdbc:h2:mem:dbr2",
"hapi.fhir.cr_enabled=false", "hapi.fhir.cr_enabled=false",
}) })
public class ExampleServerDstu2IT { class ExampleServerDstu2IT {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class);
private IGenericClient ourClient; private IGenericClient ourClient;

View File

@@ -51,7 +51,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
}) })
public class ExampleServerDstu3IT implements IServerSupport { class ExampleServerDstu3IT implements IServerSupport {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu3IT.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu3IT.class);
private IGenericClient ourClient; private IGenericClient ourClient;
@@ -74,7 +74,7 @@ public class ExampleServerDstu3IT implements IServerSupport {
} }
@Test @Test
public void testCreateAndRead() { void testCreateAndRead() {
String methodName = "testCreateResourceConditional"; String methodName = "testCreateResourceConditional";
@@ -157,7 +157,7 @@ public class ExampleServerDstu3IT implements IServerSupport {
} }
@Test @Test
public void testWebsocketSubscription() throws Exception { void testWebsocketSubscription() throws Exception {
/* /*
* Create subscription * Create subscription
*/ */

View File

@@ -55,7 +55,7 @@ class ExampleServerR4BIT {
@Test @Test
public void testBatchPutWithIdenticalTags() { void testBatchPutWithIdenticalTags() {
String batchPuts = "{\n" + String batchPuts = "{\n" +
"\t\"resourceType\": \"Bundle\",\n" + "\t\"resourceType\": \"Bundle\",\n" +
"\t\"id\": \"patients\",\n" + "\t\"id\": \"patients\",\n" +

View File

@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
@@ -16,11 +17,9 @@ import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.io.IOException; import java.io.IOException;
@@ -37,10 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters; import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters;
import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart; import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart;
@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class, NicknameServiceConfig.class}, properties = {
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class},
properties = {
"spring.datasource.url=jdbc:h2:mem:dbr4", "spring.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.enable_repository_validating_interceptor=true", "hapi.fhir.enable_repository_validating_interceptor=true",
"hapi.fhir.fhir_version=r4", "hapi.fhir.fhir_version=r4",
@@ -147,7 +143,7 @@ class ExampleServerR4IT implements IServerSupport{
return result.get(0); return result.get(0);
} }
@Test @Test
public void testBatchPutWithIdenticalTags() { void testBatchPutWithIdenticalTags() {
String batchPuts = "{\n" + String batchPuts = "{\n" +
"\t\"resourceType\": \"Bundle\",\n" + "\t\"resourceType\": \"Bundle\",\n" +
"\t\"id\": \"patients\",\n" + "\t\"id\": \"patients\",\n" +

View File

@@ -53,7 +53,7 @@ public class ExampleServerR5IT {
@Test @Test
public void testCreateAndRead() { void testCreateAndRead() {
String methodName = "testCreateResourceConditional"; String methodName = "testCreateResourceConditional";
@@ -66,7 +66,7 @@ public class ExampleServerR5IT {
} }
@Test @Test
public void testWebsocketSubscription() throws Exception { void testWebsocketSubscription() throws Exception {
String endpoint = "ws://localhost:" + port + "/websocket"; String endpoint = "ws://localhost:" + port + "/websocket";
/* /*
* Create topic * Create topic

View File

@@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
"hapi.fhir.partitioning.partitioning_include_in_search_hashes=false", "hapi.fhir.partitioning.partitioning_include_in_search_hashes=false",
}) })
public class MultitenantServerR4IT { class MultitenantServerR4IT {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class);
@@ -41,7 +41,7 @@ public class MultitenantServerR4IT {
@Test @Test
public void testCreateAndReadInTenantA() { void testCreateAndReadInTenantA() {
// Create tenant A // Create tenant A
@@ -67,7 +67,7 @@ public class MultitenantServerR4IT {
} }
@Test @Test
public void testCreateAndReadInTenantB() { void testCreateAndReadInTenantB() {
// Create tenant A // Create tenant A

View File

@@ -18,7 +18,7 @@ public class SocketImplementation {
private final String myCriteria; private final String myCriteria;
protected String myError; protected String myError;
protected boolean myGotBound; protected boolean myGotBound;
private final List<String> myMessages = new ArrayList<String>(); private final List<String> myMessages = new ArrayList<>();
protected int myPingCount; protected int myPingCount;
protected String mySubsId; protected String mySubsId;
private Session session; private Session session;

View File

@@ -64,9 +64,10 @@ hapi:
# swiss: # swiss:
# name: swiss.mednet.fhir # name: swiss.mednet.fhir
# version: 0.8.0 # version: 0.8.0
# reloadExisting : false
# example not from registry # example not from registry
# ips_1_0_0: # ips_1_0_0:
# url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz # packageUrl: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz
# name: hl7.fhir.uv.ips # name: hl7.fhir.uv.ips
# version: 1.0.0 # version: 1.0.0
# supported_resource_types: # supported_resource_types: