Adding properties to HapiProperties:

* subscription.resthook.enabled
* subscription.email.enabled
* allow_placeholder_references
This commit is contained in:
Sean McIlvenna
2019-02-11 11:19:50 -08:00
parent e21e00cf09
commit 9268c1ad3b
3 changed files with 44 additions and 24 deletions

View File

@@ -46,16 +46,17 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
retVal.setAllowMultipleDelete(HapiProperties.getAllowMultipleDelete()); retVal.setAllowMultipleDelete(HapiProperties.getAllowMultipleDelete());
retVal.setAllowExternalReferences(HapiProperties.getAllowExternalReferences()); retVal.setAllowExternalReferences(HapiProperties.getAllowExternalReferences());
retVal.setExpungeEnabled(HapiProperties.getExpungeEnabled()); retVal.setExpungeEnabled(HapiProperties.getExpungeEnabled());
retVal.setAutoCreatePlaceholderReferenceTargets(HapiProperties.getAllowPlaceholderReferences());
// You can enable these if you want to support Subscriptions from your server // You can enable these if you want to support Subscriptions from your server
if (false) { if (HapiProperties.getSubscriptionRestHookEnabled()) {
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
} }
if (false) { if (HapiProperties.getSubscriptionEmailEnabled()) {
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
} }
return retVal; return retVal;
} }
@Bean @Bean

View File

@@ -1,3 +1,4 @@
package ca.uhn.fhir.jpa.demo; package ca.uhn.fhir.jpa.demo;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
@@ -11,30 +12,33 @@ import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
public class HapiProperties { public class HapiProperties {
public static final String SERVER_ADDRESS = "server_address"; private static final String SERVER_ADDRESS = "server_address";
public static final String DEFAULT_PRETTY_PRINT = "default_pretty_print"; private static final String DEFAULT_PRETTY_PRINT = "default_pretty_print";
public static final String MAX_PAGE_SIZE = "max_page_size"; private static final String MAX_PAGE_SIZE = "max_page_size";
public static final String DEFAULT_PAGE_SIZE = "default_page_size"; private static final String DEFAULT_PAGE_SIZE = "default_page_size";
public static final String LOGGER_NAME = "logger.name"; private static final String LOGGER_NAME = "logger.name";
public static final String LOGGER_FORMAT = "logger.format"; private static final String LOGGER_FORMAT = "logger.format";
public static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references"; private static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references";
public static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete"; private static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete";
public static final String DATASOURCE_PASSWORD = "datasource.password"; private static final String DATASOURCE_PASSWORD = "datasource.password";
public static final String DATASOURCE_USERNAME = "datasource.username"; private static final String DATASOURCE_USERNAME = "datasource.username";
public static final String DATASOURCE_URL = "datasource.url"; private static final String DATASOURCE_URL = "datasource.url";
public static final String DATASOURCE_DRIVER = "datasource.driver"; private static final String DATASOURCE_DRIVER = "datasource.driver";
public static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions"; private static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions";
public static final String LOGGER_ERROR_FORMAT = "logger.error_format"; private static final String LOGGER_ERROR_FORMAT = "logger.error_format";
public static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name"; private static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name";
public static final String SERVER_BASE = "server.base"; private static final String SERVER_BASE = "server.base";
public static final String TEST_PORT = "test.port"; private static final String TEST_PORT = "test.port";
public static final String SERVER_NAME = "server.name"; private static final String SERVER_NAME = "server.name";
public static final String SERVER_ID = "server.id"; private static final String SERVER_ID = "server.id";
private static Properties properties; private static final String ALLOW_PLACEHOLDER_REFERENCES = "allow_placeholder_references";
private static final String HAPI_PROPERTIES = "hapi.properties"; private static final String HAPI_PROPERTIES = "hapi.properties";
private static final String FHIR_VERSION = "fhir_version"; private static final String FHIR_VERSION = "fhir_version";
private static final String DEFAULT_ENCODING = "default_encoding"; private static final String DEFAULT_ENCODING = "default_encoding";
private static final String ETAG_SUPPORT = "etag_support"; 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() { public static Properties getProperties() {
if (properties == null) { if (properties == null) {
@@ -207,4 +211,16 @@ public class HapiProperties {
public static String getServerId() { public static String getServerId() {
return HapiProperties.getProperty(SERVER_ID, "home"); 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);
}
} }

View File

@@ -6,6 +6,7 @@ default_page_size=20
max_page_size=200 max_page_size=200
allow_multiple_delete=true allow_multiple_delete=true
allow_external_references=true allow_external_references=true
allow_placeholder_references=true
expunge_enabled=true expunge_enabled=true
persistence_unit_name=HAPI_PU persistence_unit_name=HAPI_PU
logger.name=fhirtest.access logger.name=fhirtest.access
@@ -20,6 +21,8 @@ server.base=/baseDstu3
server.name=Local Tester server.name=Local Tester
server.id=home server.id=home
test.port= test.port=
subscription.email.enabled=true
subscription.resthook.enabled=true
hibernate.dialect=ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect hibernate.dialect=ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect
hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory
hibernate.format_sql=false hibernate.format_sql=false