diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java index a396ee4..f347915 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java @@ -28,6 +28,9 @@ public class FhirServerConfigCommon { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class); + private Boolean autoCreatePlaceholderReferenceTargets = HapiProperties.getAutoCreatePlaceholderReferenceTargets(); + private Boolean enforceReferentialIntegrityOnWrite = HapiProperties.getEnforceReferentialIntegrityOnWrite(); + private Boolean enforceReferentialIntegrityOnDelete = HapiProperties.getEnforceReferentialIntegrityOnDelete(); private Boolean allowContainsSearches = HapiProperties.getAllowContainsSearches(); private Boolean allowMultipleDelete = HapiProperties.getAllowMultipleDelete(); private Boolean allowExternalReferences = HapiProperties.getAllowExternalReferences(); @@ -82,6 +85,9 @@ public class FhirServerConfigCommon { public DaoConfig daoConfig() { DaoConfig retVal = new DaoConfig(); + retVal.setAutoCreatePlaceholderReferenceTargets(this.autoCreatePlaceholderReferenceTargets); + retVal.setEnforceReferentialIntegrityOnWrite(this.enforceReferentialIntegrityOnWrite); + retVal.setEnforceReferentialIntegrityOnDelete(this.enforceReferentialIntegrityOnDelete); retVal.setAllowContainsSearches(this.allowContainsSearches); retVal.setAllowMultipleDelete(this.allowMultipleDelete); retVal.setAllowExternalReferences(this.allowExternalReferences); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java index 81fd2e0..8b3bfeb 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java @@ -16,7 +16,10 @@ import java.util.stream.Collectors; import static org.apache.commons.lang3.StringUtils.*; public class HapiProperties { - public static final String BINARY_STORAGE_ENABLED = "binary_storage.enabled"; + static final String AUTO_CREATE_PLACEHOLDER_REFERENCE_TARGETS = "auto_create_placeholder_reference_targets"; + static final String ENFORCE_REFERENTIAL_INTEGRITY_ON_WRITE = "enforce_referential_integrity_on_write"; + static final String ENFORCE_REFERENTIAL_INTEGRITY_ON_DELETE = "enforce_referential_integrity_on_delete"; + static final String BINARY_STORAGE_ENABLED = "binary_storage.enabled"; static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references"; static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete"; static final String ALLOW_PLACEHOLDER_REFERENCES = "allow_placeholder_references"; @@ -377,8 +380,19 @@ public class HapiProperties { } public static boolean getGraphqlEnabled() { - return HapiProperties.getBooleanProperty(GRAPHQL_ENABLED, true); + return HapiProperties.getBooleanProperty(GRAPHQL_ENABLED, true); } + public static boolean getEnforceReferentialIntegrityOnDelete() { + return HapiProperties.getBooleanProperty(ENFORCE_REFERENTIAL_INTEGRITY_ON_DELETE, true); + } + + public static boolean getEnforceReferentialIntegrityOnWrite() { + return HapiProperties.getBooleanProperty(ENFORCE_REFERENTIAL_INTEGRITY_ON_WRITE, true); + } + + public static boolean getAutoCreatePlaceholderReferenceTargets() { + return HapiProperties.getBooleanProperty(AUTO_CREATE_PLACEHOLDER_REFERENCE_TARGETS, true); + } } diff --git a/src/main/resources/hapi.properties b/src/main/resources/hapi.properties index a29ca68..0b92af1 100644 --- a/src/main/resources/hapi.properties +++ b/src/main/resources/hapi.properties @@ -13,6 +13,9 @@ fhir_version=R4 # accessible from the server itself. server_address=http://localhost:8080/hapi-fhir-jpaserver/fhir/ +auto_create_placeholder_reference_targets=true +enforce_referential_integrity_on_write=true +enforce_referential_integrity_on_delete=true default_encoding=JSON etag_support=ENABLED reuse_cached_search_results_millis=-1