Merge pull request #564 from winne42/feature/add_configuration_for_auto_version_references

#563 Add configuration for auto-versioning references
This commit is contained in:
Patrick Werner
2023-07-18 14:34:42 +02:00
committed by GitHub
4 changed files with 16 additions and 6 deletions

View File

@@ -11,9 +11,11 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@ConfigurationProperties(prefix = "hapi.fhir")
@Configuration
@@ -32,6 +34,7 @@ public class AppProperties {
private Boolean allow_multiple_delete = false;
private Boolean allow_override_default_search_params = true;
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 delete_expunge_enabled = false;
private Boolean enable_index_missing_fields = false;
@@ -84,7 +87,7 @@ public class AppProperties {
private Integer bundle_batch_pool_size = 20;
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<>();
@@ -306,6 +309,10 @@ public class AppProperties {
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() {
return default_page_size;
}
@@ -570,7 +577,7 @@ public class AppProperties {
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;
}

View File

@@ -25,7 +25,6 @@ import org.springframework.context.annotation.Primary;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import java.util.HashSet;
import java.util.stream.Collectors;
/**
@@ -47,6 +46,7 @@ public class FhirServerConfigCommon {
ourLog.info("Server configured to " + (appProperties.getExpunge_enabled() ? "enable" : "disable") + " expunges");
ourLog.info("Server configured to " + (appProperties.getAllow_override_default_search_params() ? "allow" : "deny") + " 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 auto-version references at paths {}", appProperties.getAuto_version_reference_at_paths());
if (appProperties.getSubscription().getEmail() != null) {
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
@@ -84,6 +84,7 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? StorageSettings.IndexEnabledEnum.ENABLED : StorageSettings.IndexEnabledEnum.DISABLED);
jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
jpaStorageSettings.setAutoVersionReferenceAtPaths(appProperties.getAuto_version_reference_at_paths());
jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
jpaStorageSettings.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
jpaStorageSettings.setAllowContainsSearches(appProperties.getAllow_contains_searches());
@@ -125,9 +126,9 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
jpaStorageSettings.setAdvancedHSearchIndexing(appProperties.getAdvanced_lucene_indexing());
jpaStorageSettings.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls()));
jpaStorageSettings.setTreatBaseUrlsAsLocal(appProperties.getLocal_base_urls());
if (appProperties.getLastn_enabled()) {
if (appProperties.getLastn_enabled()) {
jpaStorageSettings.setLastNEnabled(true);
}

View File

@@ -26,7 +26,7 @@ public class FhirTesterConfig {
* 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
* address here.
*
* <p>
* 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
* (or other container) installation, this will end up being something

View File

@@ -99,6 +99,8 @@ hapi:
# allow_multiple_delete: true
# allow_override_default_search_params: true
# 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
# ips_enabled: false
# default_encoding: JSON