From c2b7f5da77112706ae133b07d4a941ca58a606f5 Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Mon, 30 Nov 2020 13:58:13 +0100 Subject: [PATCH 1/2] updated hapi jpastarter zvpm config --- src/main/resources/application.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index abb95b2..d9f3cd3 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -27,6 +27,8 @@ spring: hapi: fhir: + ### enable to set the Server URL +# server_address: http://hapi.fhir.org/baseR4 ### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5 fhir_version: R4 # defer_indexing_for_codesystems_of_size: 101 From bb99a69085f6ad294e248664d7344cf1338eebf2 Mon Sep 17 00:00:00 2001 From: Vladimir Nemergut Date: Wed, 2 Dec 2020 11:37:59 +0100 Subject: [PATCH 2/2] Conditionally add the default NarrativeGenerator to the context #182 --- .../java/ca/uhn/fhir/jpa/starter/AppProperties.java | 11 +++++++++++ .../ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java | 8 +++++++- src/main/resources/application.yaml | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index 2835656..722f517 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -52,6 +52,7 @@ public class AppProperties { private ClientIdStrategyEnum client_id_strategy = ClientIdStrategyEnum.ALPHANUMERIC; private List supported_resource_types = new ArrayList<>(); private List allowed_bundle_types = null; + private Boolean narrative_enabled = true; private Validation validation = new Validation(); private List tester = ImmutableList.of(new Tester()); @@ -371,6 +372,16 @@ public class AppProperties { this.tester = tester; } + public Boolean getNarrative_enabled() + { + return narrative_enabled; + } + + public void setNarrative_enabled(Boolean narrative_enabled) + { + this.narrative_enabled = narrative_enabled; + } + public static class Cors { private Boolean allow_Credentials = true; private List allowed_origin = ImmutableList.of("*"); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java index 41743a3..99fe658 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java @@ -21,6 +21,8 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; +import ca.uhn.fhir.narrative.INarrativeGenerator; +import ca.uhn.fhir.narrative2.NullNarrativeGenerator; import ca.uhn.fhir.rest.server.ETagSupportEnum; import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy; import ca.uhn.fhir.rest.server.RestfulServer; @@ -177,7 +179,11 @@ public class BaseJpaRestfulServer extends RestfulServer { * This server tries to dynamically generate narratives */ FhirContext ctx = getFhirContext(); - ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator()); + INarrativeGenerator theNarrativeGenerator = + appProperties.getNarrative_enabled() ? + new DefaultThymeleafNarrativeGenerator() : + new NullNarrativeGenerator(); + ctx.setNarrativeGenerator(theNarrativeGenerator); /* * Default to JSON and pretty printing diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index d9f3cd3..cc33d00 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -63,6 +63,7 @@ hapi: # fhirpath_interceptor_enabled: false # filter_search_enabled: true # graphql_enabled: true +# narrative_enabled: true #partitioning: # cross_partition_reference_mode: true # multitenancy_enabled: true