diff --git a/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java b/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java index 1f6182b..7e3a887 100644 --- a/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java @@ -46,16 +46,17 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 { retVal.setAllowMultipleDelete(HapiProperties.getAllowMultipleDelete()); retVal.setAllowExternalReferences(HapiProperties.getAllowExternalReferences()); retVal.setExpungeEnabled(HapiProperties.getExpungeEnabled()); - + retVal.setAutoCreatePlaceholderReferenceTargets(HapiProperties.getAllowPlaceholderReferences()); + // You can enable these if you want to support Subscriptions from your server - if (false) { + if (HapiProperties.getSubscriptionRestHookEnabled()) { retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); } - if (false) { + if (HapiProperties.getSubscriptionEmailEnabled()) { retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); } - return retVal; + return retVal; } @Bean diff --git a/src/main/java/ca/uhn/fhir/jpa/demo/HapiProperties.java b/src/main/java/ca/uhn/fhir/jpa/demo/HapiProperties.java index a04a429..183db20 100644 --- a/src/main/java/ca/uhn/fhir/jpa/demo/HapiProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/demo/HapiProperties.java @@ -1,3 +1,4 @@ + package ca.uhn.fhir.jpa.demo; import ca.uhn.fhir.context.ConfigurationException; @@ -11,30 +12,33 @@ import java.io.InputStream; import java.util.Properties; public class HapiProperties { - public static final String SERVER_ADDRESS = "server_address"; - public static final String DEFAULT_PRETTY_PRINT = "default_pretty_print"; - public static final String MAX_PAGE_SIZE = "max_page_size"; - public static final String DEFAULT_PAGE_SIZE = "default_page_size"; - public static final String LOGGER_NAME = "logger.name"; - public static final String LOGGER_FORMAT = "logger.format"; - public static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references"; - public static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete"; - public static final String DATASOURCE_PASSWORD = "datasource.password"; - public static final String DATASOURCE_USERNAME = "datasource.username"; - public static final String DATASOURCE_URL = "datasource.url"; - public static final String DATASOURCE_DRIVER = "datasource.driver"; - public static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions"; - public static final String LOGGER_ERROR_FORMAT = "logger.error_format"; - public static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name"; - public static final String SERVER_BASE = "server.base"; - public static final String TEST_PORT = "test.port"; - public static final String SERVER_NAME = "server.name"; - public static final String SERVER_ID = "server.id"; - private static Properties properties; + private static final String SERVER_ADDRESS = "server_address"; + private static final String DEFAULT_PRETTY_PRINT = "default_pretty_print"; + private static final String MAX_PAGE_SIZE = "max_page_size"; + private static final String DEFAULT_PAGE_SIZE = "default_page_size"; + private static final String LOGGER_NAME = "logger.name"; + private static final String LOGGER_FORMAT = "logger.format"; + private static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references"; + private static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete"; + private static final String DATASOURCE_PASSWORD = "datasource.password"; + private static final String DATASOURCE_USERNAME = "datasource.username"; + private static final String DATASOURCE_URL = "datasource.url"; + private static final String DATASOURCE_DRIVER = "datasource.driver"; + private static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions"; + private static final String LOGGER_ERROR_FORMAT = "logger.error_format"; + private static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name"; + private static final String SERVER_BASE = "server.base"; + private static final String TEST_PORT = "test.port"; + private static final String SERVER_NAME = "server.name"; + private static final String SERVER_ID = "server.id"; + private static final String ALLOW_PLACEHOLDER_REFERENCES = "allow_placeholder_references"; private static final String HAPI_PROPERTIES = "hapi.properties"; private static final String FHIR_VERSION = "fhir_version"; private static final String DEFAULT_ENCODING = "default_encoding"; private static final String ETAG_SUPPORT = "etag_support"; + private static final String SUBSCRIPTION_EMAIL_ENABLED = "subscription.email.enabled"; + private static final String SUBSCRIPTION_RESTHOOK_ENABLED = "subscription.resthook.enabled"; + private static Properties properties; public static Properties getProperties() { if (properties == null) { @@ -207,4 +211,16 @@ public class HapiProperties { public static String getServerId() { return HapiProperties.getProperty(SERVER_ID, "home"); } + + public static Boolean getAllowPlaceholderReferences() { + return HapiProperties.getBooleanProperty(ALLOW_PLACEHOLDER_REFERENCES, true); + } + + public static Boolean getSubscriptionEmailEnabled() { + return HapiProperties.getBooleanProperty(SUBSCRIPTION_EMAIL_ENABLED, true); + } + + public static Boolean getSubscriptionRestHookEnabled() { + return HapiProperties.getBooleanProperty(SUBSCRIPTION_RESTHOOK_ENABLED, true); + } } diff --git a/src/main/resources/hapi.properties b/src/main/resources/hapi.properties index 40a0336..a3c43aa 100644 --- a/src/main/resources/hapi.properties +++ b/src/main/resources/hapi.properties @@ -6,6 +6,7 @@ default_page_size=20 max_page_size=200 allow_multiple_delete=true allow_external_references=true +allow_placeholder_references=true expunge_enabled=true persistence_unit_name=HAPI_PU logger.name=fhirtest.access @@ -20,6 +21,8 @@ server.base=/baseDstu3 server.name=Local Tester server.id=home test.port= +subscription.email.enabled=true +subscription.resthook.enabled=true hibernate.dialect=ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory hibernate.format_sql=false