Unit Test work - still cannot get Dstu3 working after several attempts, but included the skelton of a test to capture the effort anyways.
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@EnableConfigurationProperties
|
||||
public class AppProperties {
|
||||
|
||||
private Boolean cql_enabled = false;
|
||||
private Boolean empi_enabled = false;
|
||||
private Boolean allow_cascading_deletes = false;
|
||||
private Boolean allow_contains_searches = true;
|
||||
@@ -85,6 +86,14 @@ public class AppProperties {
|
||||
this.partitioning = partitioning;
|
||||
}
|
||||
|
||||
public Boolean getCql_enabled() {
|
||||
return cql_enabled;
|
||||
}
|
||||
|
||||
public void setCql_enabled(Boolean cql_enabled) {
|
||||
this.cql_enabled = cql_enabled;
|
||||
}
|
||||
|
||||
public Boolean getEmpi_enabled() {
|
||||
return empi_enabled;
|
||||
}
|
||||
@@ -93,7 +102,6 @@ public class AppProperties {
|
||||
this.empi_enabled = empi_enabled;
|
||||
}
|
||||
|
||||
|
||||
public Cors getCors() {
|
||||
return cors;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class Application extends SpringBootServletInitializer {
|
||||
System.setProperty("spring.batch.job.enabled", "false");
|
||||
SpringApplication.run(Application.class, args);
|
||||
|
||||
//Server is now accessible at eg. http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata
|
||||
//UI is now accessible at http://localhost:8080/hapi-fhir-jpaserver/
|
||||
//Server is now accessible at eg. http://localhost:8080/fhir/metadata
|
||||
//UI is now accessible at http://localhost:8080/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,8 @@ package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cql.provider.CqlProviderLoader;
|
||||
import ca.uhn.fhir.empi.provider.EmpiProviderLoader;
|
||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
@@ -97,6 +99,10 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
||||
@Autowired
|
||||
ApplicationContext myApplicationContext;
|
||||
|
||||
// These are set only if the features are enabled
|
||||
private CqlProviderLoader cqlProviderLoader;
|
||||
private EmpiProviderLoader empiProviderLoader;
|
||||
|
||||
public BaseJpaRestfulServer() {
|
||||
|
||||
}
|
||||
@@ -121,10 +127,21 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
||||
}
|
||||
|
||||
setFhirContext(fhirSystemDao.getContext());
|
||||
|
||||
FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
|
||||
if (fhirVersion == FhirVersionEnum.DSTU3 || fhirVersion == FhirVersionEnum.R4) {
|
||||
if (appProperties.getCql_enabled()) {
|
||||
cqlProviderLoader = myApplicationContext.getBean(CqlProviderLoader.class);
|
||||
cqlProviderLoader.loadProvider();
|
||||
}
|
||||
if (appProperties.getEmpi_enabled()) {
|
||||
empiProviderLoader = myApplicationContext.getBean(EmpiProviderLoader.class);
|
||||
empiProviderLoader.loadProvider();
|
||||
}
|
||||
}
|
||||
registerProviders(resourceProviders.createProviders());
|
||||
registerProvider(jpaSystemProvider);
|
||||
|
||||
FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
|
||||
/*
|
||||
* The conformance provider exports the supported resources, search parameters, etc for
|
||||
* this server. The JPA version adds resourceProviders counts to the exported statement, so it
|
||||
|
||||
@@ -4,11 +4,9 @@ import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
|
||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
|
||||
import ca.uhn.fhir.jpa.starter.cql.CqlConfigR4;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
@@ -18,6 +16,7 @@ import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@Conditional(OnR4Condition.class)
|
||||
@Import(CqlConfigR4.class)
|
||||
public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -7,8 +7,8 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
public class CqlConfigCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
|
||||
String property = conditionContext.getEnvironment().getProperty("hapi.fhir.cql_enabled");
|
||||
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
||||
String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cql_enabled");
|
||||
boolean enabled = Boolean.parseBoolean(property);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package ca.uhn.fhir.jpa.starter.cql;
|
||||
|
||||
import ca.uhn.fhir.cql.config.CqlR4Config;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Configuration
|
||||
@Conditional({OnR4Condition.class, CqlConfigCondition.class})
|
||||
@Conditional({CqlConfigCondition.class})
|
||||
@Import({CqlR4Config.class})
|
||||
public class CqlConfigR4 {
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ hapi:
|
||||
fhir:
|
||||
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
|
||||
fhir_version: R4
|
||||
cql_enabled: true
|
||||
# defer_indexing_for_codesystems_of_size: 101
|
||||
# implementationguides:
|
||||
# -
|
||||
@@ -50,6 +49,8 @@ hapi:
|
||||
# allow_override_default_search_params: true
|
||||
# allow_placeholder_references: true
|
||||
# auto_create_placeholder_reference_targets: false
|
||||
# cql_enabled: true
|
||||
# empi_enabled: true
|
||||
# default_encoding: JSON
|
||||
# default_pretty_print: true
|
||||
# default_page_size: 20
|
||||
|
||||
Reference in New Issue
Block a user