Add additional options

This commit is contained in:
James Agnew
2025-06-06 08:49:47 +02:00
parent 299ab28599
commit d0aa399c75
3 changed files with 57 additions and 19 deletions

View File

@@ -18,6 +18,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
@ConfigurationProperties(prefix = "hapi.fhir")
@Configuration
@EnableConfigurationProperties
@@ -44,6 +46,7 @@ public class AppProperties {
private Boolean mass_ingestion_mode_enabled = false;
private Boolean language_search_parameter_enabled = false;
private Boolean dao_scheduling_enabled = true;
private Boolean delete_enabled = true;
private Boolean delete_expunge_enabled = false;
private Boolean enable_index_missing_fields = false;
private Boolean enable_index_contained_resource = false;
@@ -107,6 +110,7 @@ public class AppProperties {
private Integer maximum_expansion_size = 1000;
private Map<String, RemoteSystem> remote_terminology_service = null;
private Boolean match_url_cache_enabled = false;
public List<String> getCustomInterceptorClasses() {
return custom_interceptor_classes;
@@ -364,6 +368,14 @@ public class AppProperties {
return delete_expunge_enabled;
}
public boolean getDelete_enabled() {
return defaultIfNull(delete_enabled, true);
}
public void setDelete_enabled(boolean theDelete_enabled) {
delete_enabled = theDelete_enabled;
}
public void setDelete_expunge_enabled(Boolean delete_expunge_enabled) {
this.delete_expunge_enabled = delete_expunge_enabled;
}
@@ -733,6 +745,14 @@ public class AppProperties {
this.remote_terminology_service = remote_terminology_service;
}
public boolean getMatch_url_cache_enabled() {
return defaultIfNull(match_url_cache_enabled, false);
}
public void setMatch_url_cache_enabled(boolean theMatchUrlCacheEnabled) {
match_url_cache_enabled = theMatchUrlCacheEnabled;
}
public static class Cors {
private Boolean allow_Credentials = true;
private List<String> allowed_origin = List.of("*");

View File

@@ -16,6 +16,8 @@ import ca.uhn.fhir.rest.server.mail.MailConfig;
import ca.uhn.fhir.rest.server.mail.MailSvc;
import com.google.common.base.Strings;
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -36,7 +38,7 @@ import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
@EnableTransactionManagement
public class FhirServerConfigCommon {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
private static final Logger ourLog = LoggerFactory.getLogger(FhirServerConfigCommon.class);
public FhirServerConfigCommon(AppProperties appProperties) {
ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny")
@@ -176,6 +178,8 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
jpaStorageSettings.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled());
jpaStorageSettings.setMatchUrlCacheEnabled(appProperties.getMatch_url_cache_enabled());
jpaStorageSettings.setDeleteEnabled(appProperties.getDelete_enabled());
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
@@ -286,6 +290,18 @@ public class FhirServerConfigCommon {
}
retVal.setConditionalCreateDuplicateIdentifiersEnabled(
appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled());
ourLog.info("""
Partitioning is enabled on this server. Settings:
* Database Partition Mode Enabled: {}
* Default Partition ID : {}
* Cross-Partition References : {}""",
databasePartitionModeEnabled,
defaultPartitionId,
retVal.getAllowReferencesAcrossPartitions());
} else {
ourLog.info("Partitioning is not enabled on this server");
}
return retVal;

View File

@@ -190,7 +190,9 @@ hapi:
# default_encoding: JSON
# default_pretty_print: true
# default_page_size: 20
# delete_enabled: true
# delete_expunge_enabled: true
# match_url_cache_enabled: false
# enable_repository_validating_interceptor: true
# enable_index_missing_fields: false
# enable_index_of_type: true
@@ -237,24 +239,24 @@ hapi:
- http://loinc.org/*
- https://loinc.org/*
# ### Uncomment the following section, and any sub-properties you need in order to enable
# ### partitioning support on this server.
# partitioning:
# allow_references_across_partitions: false
# partitioning_include_in_search_hashes: false
# default_partition_id: 0
# ### Enable the following setting to enable Database Partitioning Mode
# ### See: https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/db_partition_mode.html
# database_partition_mode_enabled: false
# ### Partition Style: Partitioning requires a partition interceptor which helps the server
# ### select which partition(s) should be accessed for a given request. You can supply your
# ### own interceptor (see https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning.html#partition-interceptors )
# ### but the following setting can also be used to use a built-in form.
# ### Patient ID Partitioning Mode uses the patient/subject ID to determine the partition
# patient_id_partitioning_mode: false
# ### Request tenant mode can be used for a multi-tenancy setup where the request path is
# ### expected to have an additional path element, e.g. GET http://example.com/fhir/TENANT-ID/Patient/A
# request_tenant_partitioning_mode: false
### Uncomment the following section, and any sub-properties you need in order to enable
### partitioning support on this server.
partitioning:
allow_references_across_partitions: false
partitioning_include_in_search_hashes: false
default_partition_id: 0
### Enable the following setting to enable Database Partitioning Mode
### See: https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/db_partition_mode.html
database_partition_mode_enabled: true
### Partition Style: Partitioning requires a partition interceptor which helps the server
### select which partition(s) should be accessed for a given request. You can supply your
### own interceptor (see https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning.html#partition-interceptors )
### but the following setting can also be used to use a built-in form.
### Patient ID Partitioning Mode uses the patient/subject ID to determine the partition
patient_id_partitioning_mode: true
### Request tenant mode can be used for a multi-tenancy setup where the request path is
### expected to have an additional path element, e.g. GET http://example.com/fhir/TENANT-ID/Patient/A
request_tenant_partitioning_mode: false
cors:
allow_Credentials: true