1
pom.xml
1
pom.xml
@@ -20,6 +20,7 @@
|
|||||||
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<spring_boot_version>2.5.2</spring_boot_version>
|
||||||
<java.version>8</java.version>
|
<java.version>8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.mdm.MdmConfig;
|
import ca.uhn.fhir.jpa.starter.mdm.MdmConfig;
|
||||||
import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion;
|
import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion;
|
||||||
import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig;
|
import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig;
|
||||||
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
|
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
|
||||||
@@ -29,6 +29,15 @@ public class Application extends SpringBootServletInitializer {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/246
|
||||||
|
* This will be allowed for a short period until we know how MDM should be configured
|
||||||
|
* or don't have multiple equal bean instantiations.
|
||||||
|
*
|
||||||
|
* This will require changes in the main project as stated in the Github comment
|
||||||
|
* */
|
||||||
|
System.setProperty("spring.main.allow-bean-definition-overriding","true");
|
||||||
|
|
||||||
System.setProperty("spring.batch.job.enabled", "false");
|
System.setProperty("spring.batch.job.enabled", "false");
|
||||||
SpringApplication.run(Application.class, args);
|
SpringApplication.run(Application.class, args);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider;
|
|||||||
import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
|
import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
|
||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
||||||
|
import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
|
||||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||||
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
|
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
|
||||||
@@ -46,19 +47,18 @@ import ca.uhn.fhir.validation.IValidatorModule;
|
|||||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
|
||||||
public class BaseJpaRestfulServer extends RestfulServer {
|
public class BaseJpaRestfulServer extends RestfulServer {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseJpaRestfulServer.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseJpaRestfulServer.class);
|
||||||
@@ -73,7 +73,7 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
IFhirSystemDao fhirSystemDao;
|
IFhirSystemDao fhirSystemDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
ResourceProviderFactory resourceProviders;
|
ResourceProviderFactory resourceProviderFactory;
|
||||||
@Autowired
|
@Autowired
|
||||||
IJpaSystemProvider jpaSystemProvider;
|
IJpaSystemProvider jpaSystemProvider;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -101,9 +101,13 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
IRepositoryValidationInterceptorFactory factory;
|
IRepositoryValidationInterceptorFactory factory;
|
||||||
// These are set only if the features are enabled
|
// These are set only if the features are enabled
|
||||||
private CqlProviderLoader cqlProviderLoader;
|
@Autowired
|
||||||
@Autowired
|
Optional<CqlProviderLoader> cqlProviderLoader;
|
||||||
private IValidationSupport myValidationSupport;
|
@Autowired
|
||||||
|
Optional<MdmProviderLoader> mdmProviderProvider;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IValidationSupport myValidationSupport;
|
||||||
|
|
||||||
public BaseJpaRestfulServer() {
|
public BaseJpaRestfulServer() {
|
||||||
}
|
}
|
||||||
@@ -127,7 +131,14 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
|||||||
|
|
||||||
setFhirContext(fhirSystemDao.getContext());
|
setFhirContext(fhirSystemDao.getContext());
|
||||||
|
|
||||||
registerProviders(resourceProviders.createProviders());
|
/*
|
||||||
|
* Order matters - the MDM provider registers itself on the resourceProviderFactory - hence the loading must be done
|
||||||
|
* ahead of provider registration
|
||||||
|
*/
|
||||||
|
if(appProperties.getMdm_enabled())
|
||||||
|
mdmProviderProvider.get().loadProvider();
|
||||||
|
|
||||||
|
registerProviders(resourceProviderFactory.createProviders());
|
||||||
registerProvider(jpaSystemProvider);
|
registerProvider(jpaSystemProvider);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -5,18 +5,23 @@ import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu3;
|
|||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
||||||
import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition;
|
import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition;
|
||||||
|
import ca.uhn.fhir.jpa.starter.cql.StarterCqlDstu3Config;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
import javax.sql.DataSource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Conditional;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Conditional(OnDSTU3Condition.class)
|
@Conditional(OnDSTU3Condition.class)
|
||||||
|
@Import(StarterCqlDstu3Config.class)
|
||||||
public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ca.uhn.fhir.jpa.mdm;
|
package ca.uhn.fhir.jpa.starter.mdm;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jpa.mdm.config.MdmConsumerConfig;
|
import ca.uhn.fhir.jpa.mdm.config.MdmConsumerConfig;
|
||||||
@@ -9,6 +9,7 @@ import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
|
|||||||
import ca.uhn.fhir.mdm.rules.config.MdmSettings;
|
import ca.uhn.fhir.mdm.rules.config.MdmSettings;
|
||||||
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
import java.io.IOException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@@ -18,12 +19,6 @@ import org.springframework.context.annotation.Import;
|
|||||||
import org.springframework.core.io.DefaultResourceLoader;
|
import org.springframework.core.io.DefaultResourceLoader;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Move this to package "ca.uhn.fhir.jpa.starter" in HAPI FHIR 5.2.0+. The lousy component scan
|
|
||||||
* in 5.1.0 picks this up even if MDM is disabled currently.
|
|
||||||
*/
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Conditional(MdmConfigCondition.class)
|
@Conditional(MdmConfigCondition.class)
|
||||||
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class})
|
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class})
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ca.uhn.fhir.jpa.mdm;
|
package ca.uhn.fhir.jpa.starter.mdm;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Condition;
|
import org.springframework.context.annotation.Condition;
|
||||||
import org.springframework.context.annotation.ConditionContext;
|
import org.springframework.context.annotation.ConditionContext;
|
||||||
@@ -81,6 +81,7 @@ hapi:
|
|||||||
# filter_search_enabled: true
|
# filter_search_enabled: true
|
||||||
# graphql_enabled: true
|
# graphql_enabled: true
|
||||||
# narrative_enabled: true
|
# narrative_enabled: true
|
||||||
|
# mdm_enabled: true
|
||||||
# partitioning:
|
# partitioning:
|
||||||
# allow_references_across_partitions: false
|
# allow_references_across_partitions: false
|
||||||
# partitioning_include_in_search_hashes: false
|
# partitioning_include_in_search_hashes: false
|
||||||
@@ -125,7 +126,7 @@ hapi:
|
|||||||
# binary_storage_enabled: true
|
# binary_storage_enabled: true
|
||||||
# bulk_export_enabled: true
|
# bulk_export_enabled: true
|
||||||
# subscription:
|
# subscription:
|
||||||
# resthook_enabled: false
|
# resthook_enabled: true
|
||||||
# websocket_enabled: false
|
# websocket_enabled: false
|
||||||
# email:
|
# email:
|
||||||
# from: some@test.com
|
# from: some@test.com
|
||||||
|
|||||||
Reference in New Issue
Block a user