Merge branch 'master' into ja_20231203_hapi_7_0

This commit is contained in:
James Agnew
2023-12-15 09:42:24 -05:00
9 changed files with 69 additions and 39 deletions

View File

@@ -27,6 +27,7 @@ public class AppProperties {
private Boolean ips_enabled = false;
private Boolean openapi_enabled = false;
private Boolean mdm_enabled = false;
private String mdm_rules_json_location = "mdm-rules.json";
private boolean advanced_lucene_indexing = false;
private boolean enable_index_of_type = false;
private Boolean allow_cascading_deletes = false;
@@ -191,7 +192,15 @@ public class AppProperties {
this.mdm_enabled = mdm_enabled;
}
public Cors getCors() {
public String getMdm_rules_json_location() {
return mdm_rules_json_location;
}
public void setMdm_rules_json_location(String mdm_rules_json_location) {
this.mdm_rules_json_location = mdm_rules_json_location;
}
public Cors getCors() {
return cors;
}

View File

@@ -55,10 +55,6 @@ public class Application extends SpringBootServletInitializer {
// UI is now accessible at http://localhost:8080/
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
@Autowired
AutowireCapableBeanFactory beanFactory;
@@ -75,31 +71,9 @@ public class Application extends SpringBootServletInitializer {
return servletRegistrationBean;
}
@Bean
public ServletRegistrationBean overlayRegistrationBean() {
AnnotationConfigWebApplicationContext annotationConfigWebApplicationContext =
new AnnotationConfigWebApplicationContext();
annotationConfigWebApplicationContext.register(FhirTesterConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet(annotationConfigWebApplicationContext);
dispatcherServlet.setContextClass(AnnotationConfigWebApplicationContext.class);
dispatcherServlet.setContextConfigLocation(FhirTesterConfig.class.getName());
ServletRegistrationBean registrationBean = new ServletRegistrationBean();
registrationBean.setServlet(dispatcherServlet);
registrationBean.addUrlMappings("/*");
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
@Bean
public ServletWebServerFactory servletWebServerFactory() {
return new JettyServletWebServerFactory();
}
// @Bean
// IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry, RestfulServer theRestfulServer) {
// return rd -> new HapiFhirRepository(theDaoRegistry, rd, theRestfulServer);
// }
}

View File

@@ -180,6 +180,13 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
if (appProperties.getMdm_enabled()) {
// MDM requires the subscription of type message
ourLog.info("Enabling message subscriptions");
jpaStorageSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE);
}
storageSettings(appProperties, jpaStorageSettings);
return jpaStorageSettings;
}

View File

@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter.mdm;
import ca.uhn.fhir.jpa.mdm.config.MdmConsumerConfig;
import ca.uhn.fhir.jpa.mdm.config.MdmSubmitterConfig;
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
@@ -20,14 +21,14 @@ import java.nio.charset.StandardCharsets;
@Configuration
@Conditional(MdmConfigCondition.class)
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class})
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class, NicknameServiceConfig.class})
public class MdmConfig {
@Bean
IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties)
throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("mdm-rules.json");
Resource resource = resourceLoader.getResource(appProperties.getMdm_rules_json_location());
String json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8);
return new MdmSettings(theMdmRuleValidator)
.setEnabled(appProperties.getMdm_enabled())

View File

@@ -137,6 +137,7 @@ hapi:
# graphql_enabled: true
narrative_enabled: false
mdm_enabled: false
mdm_rules_json_location: "mdm-rules.json"
# local_base_urls:
# - https://hapi.fhir.org/baseR4
# partitioning:

View File

@@ -0,0 +1,29 @@
package ca.uhn.fhir.jpa.starter;
import static org.assertj.core.api.Assertions.assertThat;
import org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.nickname.INicknameSvc;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = {
"hapi.fhir.fhir_version=r4",
"hapi.fhir.mdm_enabled=true"
})
class MdmTest {
@Autowired
INicknameSvc nicknameService;
@Autowired
JpaStorageSettings jpaStorageSettings;
@Test
void testApplicationStartedSuccessfully() {
assertThat(nicknameService).isNotNull();
assertThat(jpaStorageSettings.getSupportedSubscriptionTypes()).contains(SubscriptionChannelType.MESSAGE);
}
}