Skip to content

Commit fc70e52

Browse files
committed
Merge remote-tracking branch 'origin/master' into rel_8_1_tracking
2 parents 7e3f997 + 8e7cb0e commit fc70e52

File tree

6 files changed

+148
-1
lines changed

6 files changed

+148
-1
lines changed

src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ public class AppProperties {
100100
private boolean userRequestRetryVersionConflictsInterceptorEnabled = false;
101101

102102
private List<Integer> search_prefetch_thresholds = new ArrayList<>();
103+
private Boolean pre_expand_value_sets = true;
104+
private Boolean enable_task_pre_expand_value_sets = true;
105+
private Integer pre_expand_value_sets_default_count = 1000;
106+
private Integer pre_expand_value_sets_max_count = 1000;
107+
private Integer maximum_expansion_size = 1000;
103108

104109
public List<String> getCustomInterceptorClasses() {
105110
return custom_interceptor_classes;
@@ -678,6 +683,46 @@ public void setResource_dbhistory_enabled(Boolean resource_dbhistory_enabled) {
678683
this.resource_dbhistory_enabled = resource_dbhistory_enabled;
679684
}
680685

686+
public Boolean getPre_expand_value_sets() {
687+
return this.pre_expand_value_sets;
688+
}
689+
690+
public void setPre_expand_value_sets(Boolean pre_expand_value_sets) {
691+
this.pre_expand_value_sets = pre_expand_value_sets;
692+
}
693+
694+
public Boolean getEnable_task_pre_expand_value_sets() {
695+
return this.enable_task_pre_expand_value_sets;
696+
}
697+
698+
public void setEnable_task_pre_expand_value_setss(Boolean enable_task_pre_expand_value_sets) {
699+
this.enable_task_pre_expand_value_sets = enable_task_pre_expand_value_sets;
700+
}
701+
702+
public Integer getPre_expand_value_sets_default_count() {
703+
return pre_expand_value_sets_default_count;
704+
}
705+
706+
public void setPre_expand_value_sets_default_count(Integer pre_expand_value_sets_default_count) {
707+
this.pre_expand_value_sets_default_count = pre_expand_value_sets_default_count;
708+
}
709+
710+
public Integer getPre_expand_value_sets_max_count() {
711+
return pre_expand_value_sets_max_count;
712+
}
713+
714+
public void setPre_expand_value_sets_max_count(Integer pre_expand_value_sets_max_count) {
715+
this.pre_expand_value_sets_max_count = pre_expand_value_sets_max_count;
716+
}
717+
718+
public Integer getMaximum_expansion_size() {
719+
return maximum_expansion_size;
720+
}
721+
722+
public void setMaximum_expansion_size(Integer maximum_expansion_size) {
723+
this.maximum_expansion_size = maximum_expansion_size;
724+
}
725+
681726
public static class Cors {
682727
private Boolean allow_Credentials = true;
683728
private List<String> allowed_origin = List.of("*");
@@ -879,6 +924,8 @@ public static class Subscription {
879924
private Boolean resthook_enabled = false;
880925
private Boolean websocket_enabled = false;
881926
private Email email = null;
927+
private Integer polling_interval_ms = null;
928+
private Boolean immediately_queued = false;
882929

883930
public Boolean getResthook_enabled() {
884931
return resthook_enabled;
@@ -904,6 +951,22 @@ public void setEmail(Email email) {
904951
this.email = email;
905952
}
906953

954+
public Integer getPolling_interval_ms() {
955+
return polling_interval_ms;
956+
}
957+
958+
public void setPolling_interval_ms(Integer polling_interval_ms) {
959+
this.polling_interval_ms = polling_interval_ms;
960+
}
961+
962+
public Boolean getImmediately_queued() {
963+
return immediately_queued;
964+
}
965+
966+
public void setImmediately_queued(Boolean immediately_queued) {
967+
this.immediately_queued = immediately_queued;
968+
}
969+
907970
public static class Email {
908971
private String from;
909972
private String host;

src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ public FhirServerConfigCommon(AppProperties appProperties) {
8888
if (appProperties.getEnable_index_contained_resource() == Boolean.TRUE) {
8989
ourLog.info("Indexed on contained resource enabled");
9090
}
91+
92+
ourLog.info("Server configured to " + (appProperties.getPre_expand_value_sets() ? "enable" : "disable")
93+
+ " value set pre-expansion");
94+
ourLog.info(
95+
"Server configured to " + (appProperties.getEnable_task_pre_expand_value_sets() ? "enable" : "disable")
96+
+ " value set pre-expansion task");
97+
ourLog.info("Server configured for pre-expand value set default count of "
98+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
99+
ourLog.info("Server configured for pre-expand value set max count of "
100+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
101+
ourLog.info("Server configured for maximum expansion size of "
102+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
91103
}
92104

93105
@Bean
@@ -114,6 +126,18 @@ public SubscriptionSettings subscriptionSettings(AppProperties appProperties) {
114126
subscriptionSettings.addSupportedSubscriptionType(
115127
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
116128
}
129+
if (appProperties.getSubscription().getPolling_interval_ms() != null) {
130+
ourLog.info(
131+
"Setting subscription polling interval to {} ms",
132+
appProperties.getSubscription().getPolling_interval_ms());
133+
subscriptionSettings.setSubscriptionIntervalInMs(
134+
appProperties.getSubscription().getPolling_interval_ms());
135+
}
136+
if (appProperties.getSubscription().getImmediately_queued()) {
137+
ourLog.info("Subscription update will be queued immediately");
138+
subscriptionSettings.setSubscriptionChangeQueuedImmediately(
139+
appProperties.getSubscription().getImmediately_queued());
140+
}
117141
}
118142
if (appProperties.getMdm_enabled()) {
119143
// MDM requires the subscription of type message
@@ -130,6 +154,12 @@ public SubscriptionSettings subscriptionSettings(AppProperties appProperties) {
130154
public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
131155
JpaStorageSettings jpaStorageSettings = new JpaStorageSettings();
132156

157+
jpaStorageSettings.setPreExpandValueSets(appProperties.getPre_expand_value_sets());
158+
jpaStorageSettings.setEnableTaskPreExpandValueSets(appProperties.getEnable_task_pre_expand_value_sets());
159+
jpaStorageSettings.setPreExpandValueSetsDefaultCount(appProperties.getPre_expand_value_sets_default_count());
160+
jpaStorageSettings.setPreExpandValueSetsMaxCount(appProperties.getPre_expand_value_sets_max_count());
161+
jpaStorageSettings.setMaximumExpansionSize(appProperties.getMaximum_expansion_size());
162+
133163
jpaStorageSettings.setIndexMissingFields(
134164
appProperties.getEnable_index_missing_fields()
135165
? StorageSettings.IndexEnabledEnum.ENABLED

src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
3333
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
3434
import ca.uhn.fhir.jpa.provider.DaoRegistryResourceSupportedSvc;
35+
import ca.uhn.fhir.jpa.provider.DiffProvider;
3536
import ca.uhn.fhir.jpa.provider.IJpaSystemProvider;
3637
import ca.uhn.fhir.jpa.provider.JpaCapabilityStatementProvider;
3738
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
@@ -289,7 +290,8 @@ public RestfulServer restfulServer(
289290
ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc,
290291
ApplicationContext appContext,
291292
Optional<IpsOperationProvider> theIpsOperationProvider,
292-
Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider) {
293+
Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider,
294+
DiffProvider diffProvider) {
293295
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
294296

295297
List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
@@ -458,6 +460,9 @@ public RestfulServer restfulServer(
458460
// Validation
459461
repositoryValidatingInterceptor.ifPresent(fhirServer::registerInterceptor);
460462

463+
// Diff Provider
464+
fhirServer.registerProvider(diffProvider);
465+
461466
// register custom interceptors
462467
registerCustomInterceptors(fhirServer, appContext, appProperties.getCustomInterceptorClasses());
463468

src/main/resources/application.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ hapi:
218218
# userRequestRetryVersionConflictsInterceptorEnabled : false
219219
# local_base_urls:
220220
# - https://hapi.fhir.org/baseR4
221+
# pre_expand_value_sets: true
222+
# enable_task_pre_expand_value_sets: true
223+
# pre_expand_value_sets_default_count: 1000
224+
# pre_expand_value_sets_max_count: 1000
225+
# maximum_expansion_size: 1000
226+
221227
logical_urls:
222228
- http://terminology.hl7.org/*
223229
- https://terminology.hl7.org/*
@@ -303,6 +309,8 @@ hapi:
303309
# subscription:
304310
# resthook_enabled: true
305311
# websocket_enabled: false
312+
# polling_interval_ms: 5000
313+
# immediately_queued: false
306314
# email:
307315
308316
# host: google.com

src/main/resources/cds.application.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ hapi:
215215
mdm_rules_json_location: "mdm-rules.json"
216216
# local_base_urls:
217217
# - https://hapi.fhir.org/baseR4
218+
219+
# pre_expand_value_sets: true
220+
# enable_task_pre_expand_value_sets: true
221+
# pre_expand_value_sets_default_count: 1000
222+
# pre_expand_value_sets_max_count: 1000
223+
# maximum_expansion_size: 1000
224+
218225
logical_urls:
219226
- http://terminology.hl7.org/*
220227
- https://terminology.hl7.org/*

src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,39 @@ void testActuatorEndpointExists(String endpoint) throws IOException, URISyntaxEx
325325

326326
}
327327

328+
@Test
329+
void testDiffOperationIsRegistered() {
330+
String methodName = "testDiff";
331+
ourLog.info("Entering " + methodName + "()...");
332+
333+
Patient pt = new Patient();
334+
pt.setActive(true);
335+
pt.getBirthDateElement().setValueAsString("2020-01-01");
336+
pt.addIdentifier().setSystem("http://foo").setValue("12345");
337+
pt.addName().setFamily(methodName);
338+
IIdType id = ourClient.create().resource(pt).execute().getId();
339+
340+
//now update the patient
341+
pt.setId(id);
342+
pt.getBirthDateElement().setValueAsString("2025-01-01");
343+
ourClient.update().resource(pt).execute();
344+
345+
//now try a diff
346+
Parameters outParams = ourClient.operation().onInstance(id).named("$diff").withNoParameters(Parameters.class).execute();
347+
ourLog.trace("Params->\n{}", ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outParams));
348+
boolean foundDobChange = false;
349+
//really, if we get a response at all, then the Diff worked, but we'll check the contents here anyway for good measure to see that our change is reflected
350+
for(Parameters.ParametersParameterComponent ppc : outParams.getParameter() ) {
351+
for(Parameters.ParametersParameterComponent ppc2 : ppc.getPart() ) {
352+
if( "Patient.birthDate".equals(ppc2.getValue().toString()) ){
353+
foundDobChange = true;
354+
break;
355+
}
356+
}
357+
}
358+
assertTrue(foundDobChange);
359+
}
360+
328361
@BeforeEach
329362
void beforeEach() {
330363

@@ -338,4 +371,5 @@ void beforeEach() {
338371
// return activeSubscriptionCount() == 2; // 2 subscription based on mdm-rules.json
339372
//});
340373
}
374+
341375
}

0 commit comments

Comments
 (0)