Skip to content

Commit d0aa399

Browse files
James AgnewJames Agnew
authored andcommitted
Add additional options
1 parent 299ab28 commit d0aa399

File tree

3 files changed

+57
-19
lines changed

3 files changed

+57
-19
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import java.util.Objects;
1919
import java.util.Set;
2020

21+
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
22+
2123
@ConfigurationProperties(prefix = "hapi.fhir")
2224
@Configuration
2325
@EnableConfigurationProperties
@@ -44,6 +46,7 @@ public class AppProperties {
4446
private Boolean mass_ingestion_mode_enabled = false;
4547
private Boolean language_search_parameter_enabled = false;
4648
private Boolean dao_scheduling_enabled = true;
49+
private Boolean delete_enabled = true;
4750
private Boolean delete_expunge_enabled = false;
4851
private Boolean enable_index_missing_fields = false;
4952
private Boolean enable_index_contained_resource = false;
@@ -107,6 +110,7 @@ public class AppProperties {
107110
private Integer maximum_expansion_size = 1000;
108111

109112
private Map<String, RemoteSystem> remote_terminology_service = null;
113+
private Boolean match_url_cache_enabled = false;
110114

111115
public List<String> getCustomInterceptorClasses() {
112116
return custom_interceptor_classes;
@@ -364,6 +368,14 @@ public Boolean getDelete_expunge_enabled() {
364368
return delete_expunge_enabled;
365369
}
366370

371+
public boolean getDelete_enabled() {
372+
return defaultIfNull(delete_enabled, true);
373+
}
374+
375+
public void setDelete_enabled(boolean theDelete_enabled) {
376+
delete_enabled = theDelete_enabled;
377+
}
378+
367379
public void setDelete_expunge_enabled(Boolean delete_expunge_enabled) {
368380
this.delete_expunge_enabled = delete_expunge_enabled;
369381
}
@@ -733,6 +745,14 @@ public void setRemote_terminology_service(Map<String, RemoteSystem> remote_termi
733745
this.remote_terminology_service = remote_terminology_service;
734746
}
735747

748+
public boolean getMatch_url_cache_enabled() {
749+
return defaultIfNull(match_url_cache_enabled, false);
750+
}
751+
752+
public void setMatch_url_cache_enabled(boolean theMatchUrlCacheEnabled) {
753+
match_url_cache_enabled = theMatchUrlCacheEnabled;
754+
}
755+
736756
public static class Cors {
737757
private Boolean allow_Credentials = true;
738758
private List<String> allowed_origin = List.of("*");

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import ca.uhn.fhir.rest.server.mail.MailSvc;
1717
import com.google.common.base.Strings;
1818
import org.hl7.fhir.r4.model.Bundle.BundleType;
19+
import org.slf4j.Logger;
20+
import org.slf4j.LoggerFactory;
1921
import org.springframework.boot.env.YamlPropertySourceLoader;
2022
import org.springframework.context.annotation.Bean;
2123
import org.springframework.context.annotation.Configuration;
@@ -36,7 +38,7 @@
3638
@EnableTransactionManagement
3739
public class FhirServerConfigCommon {
3840

39-
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
41+
private static final Logger ourLog = LoggerFactory.getLogger(FhirServerConfigCommon.class);
4042

4143
public FhirServerConfigCommon(AppProperties appProperties) {
4244
ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny")
@@ -176,6 +178,8 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
176178
jpaStorageSettings.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
177179
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
178180
jpaStorageSettings.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled());
181+
jpaStorageSettings.setMatchUrlCacheEnabled(appProperties.getMatch_url_cache_enabled());
182+
jpaStorageSettings.setDeleteEnabled(appProperties.getDelete_enabled());
179183
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
180184
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
181185
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
@@ -286,6 +290,18 @@ public PartitionSettings partitionSettings(AppProperties appProperties) {
286290
}
287291
retVal.setConditionalCreateDuplicateIdentifiersEnabled(
288292
appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled());
293+
294+
ourLog.info("""
295+
Partitioning is enabled on this server. Settings:
296+
* Database Partition Mode Enabled: {}
297+
* Default Partition ID : {}
298+
* Cross-Partition References : {}""",
299+
databasePartitionModeEnabled,
300+
defaultPartitionId,
301+
retVal.getAllowReferencesAcrossPartitions());
302+
303+
} else {
304+
ourLog.info("Partitioning is not enabled on this server");
289305
}
290306

291307
return retVal;

src/main/resources/application.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ hapi:
190190
# default_encoding: JSON
191191
# default_pretty_print: true
192192
# default_page_size: 20
193+
# delete_enabled: true
193194
# delete_expunge_enabled: true
195+
# match_url_cache_enabled: false
194196
# enable_repository_validating_interceptor: true
195197
# enable_index_missing_fields: false
196198
# enable_index_of_type: true
@@ -237,24 +239,24 @@ hapi:
237239
- http://loinc.org/*
238240
- https://loinc.org/*
239241

240-
# ### Uncomment the following section, and any sub-properties you need in order to enable
241-
# ### partitioning support on this server.
242-
# partitioning:
243-
# allow_references_across_partitions: false
244-
# partitioning_include_in_search_hashes: false
245-
# default_partition_id: 0
246-
# ### Enable the following setting to enable Database Partitioning Mode
247-
# ### See: https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/db_partition_mode.html
248-
# database_partition_mode_enabled: false
249-
# ### Partition Style: Partitioning requires a partition interceptor which helps the server
250-
# ### select which partition(s) should be accessed for a given request. You can supply your
251-
# ### own interceptor (see https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning.html#partition-interceptors )
252-
# ### but the following setting can also be used to use a built-in form.
253-
# ### Patient ID Partitioning Mode uses the patient/subject ID to determine the partition
254-
# patient_id_partitioning_mode: false
255-
# ### Request tenant mode can be used for a multi-tenancy setup where the request path is
256-
# ### expected to have an additional path element, e.g. GET http://example.com/fhir/TENANT-ID/Patient/A
257-
# request_tenant_partitioning_mode: false
242+
### Uncomment the following section, and any sub-properties you need in order to enable
243+
### partitioning support on this server.
244+
partitioning:
245+
allow_references_across_partitions: false
246+
partitioning_include_in_search_hashes: false
247+
default_partition_id: 0
248+
### Enable the following setting to enable Database Partitioning Mode
249+
### See: https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/db_partition_mode.html
250+
database_partition_mode_enabled: true
251+
### Partition Style: Partitioning requires a partition interceptor which helps the server
252+
### select which partition(s) should be accessed for a given request. You can supply your
253+
### own interceptor (see https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning.html#partition-interceptors )
254+
### but the following setting can also be used to use a built-in form.
255+
### Patient ID Partitioning Mode uses the patient/subject ID to determine the partition
256+
patient_id_partitioning_mode: true
257+
### Request tenant mode can be used for a multi-tenancy setup where the request path is
258+
### expected to have an additional path element, e.g. GET http://example.com/fhir/TENANT-ID/Patient/A
259+
request_tenant_partitioning_mode: false
258260

259261
cors:
260262
allow_Credentials: true

0 commit comments

Comments
 (0)