Merge branch 'master' of github.com:hapifhir/hapi-fhir-jpaserver-starter

This commit is contained in:
jamesagnew
2021-05-19 09:04:01 -04:00
13 changed files with 255 additions and 144 deletions

View File

@@ -14,8 +14,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<!-- FIMXME KBD Change this to 5.3.0 BEFORE merging this code to master ! --> <version>5.4.0</version>
<version>5.3.0</version>
</parent> </parent>
<artifactId>hapi-fhir-jpaserver-starter</artifactId> <artifactId>hapi-fhir-jpaserver-starter</artifactId>

View File

@@ -7,7 +7,7 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator; 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.ISearchParamRetriever; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
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;
@@ -29,17 +29,17 @@ import java.io.IOException;
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class}) @Import({MdmConsumerConfig.class, MdmSubmitterConfig.class})
public class MdmConfig { public class MdmConfig {
@Bean @Bean
MdmRuleValidator mdmRuleValidator(FhirContext theFhirContext, ISearchParamRetriever theSearchParamRetriever) { MdmRuleValidator mdmRuleValidator(FhirContext theFhirContext, ISearchParamRegistry theSearchParamRegistry) {
return new MdmRuleValidator(theFhirContext, theSearchParamRetriever); return new MdmRuleValidator(theFhirContext, theSearchParamRegistry);
} }
@Bean @Bean
IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) throws IOException { IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("mdm-rules.json"); Resource resource = resourceLoader.getResource("mdm-rules.json");
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
return new MdmSettings(theMdmRuleValidator).setEnabled(appProperties.getMdm_enabled()).setScriptText(json); return new MdmSettings(theMdmRuleValidator).setEnabled(appProperties.getMdm_enabled()).setScriptText(json);
} }
} }

View File

@@ -31,6 +31,7 @@ public class AppProperties {
private Boolean allow_placeholder_references = true; private Boolean allow_placeholder_references = true;
private Boolean auto_create_placeholder_reference_targets = false; private Boolean auto_create_placeholder_reference_targets = false;
private Boolean enable_index_missing_fields = false; private Boolean enable_index_missing_fields = false;
private Boolean enable_index_contained_resource = false;
private Boolean enable_repository_validating_interceptor = false; private Boolean enable_repository_validating_interceptor = false;
private Boolean enforce_referential_integrity_on_delete = true; private Boolean enforce_referential_integrity_on_delete = true;
private Boolean enforce_referential_integrity_on_write = true; private Boolean enforce_referential_integrity_on_write = true;
@@ -67,6 +68,9 @@ public class AppProperties {
private Boolean lastn_enabled = false; private Boolean lastn_enabled = false;
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED; private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
private Integer search_coord_core_pool_size = 20;
private Integer search_coord_max_pool_size = 100;
private Integer search_coord_queue_capacity = 200;
private Boolean use_apache_address_strategy = false; private Boolean use_apache_address_strategy = false;
private Boolean use_apache_address_strategy_https = false; private Boolean use_apache_address_strategy_https = false;
@@ -273,6 +277,14 @@ public class AppProperties {
this.enable_index_missing_fields = enable_index_missing_fields; this.enable_index_missing_fields = enable_index_missing_fields;
} }
public Boolean getEnable_index_contained_resource() {
return enable_index_contained_resource;
}
public void setEnable_index_contained_resource(Boolean enable_index_contained_resource) {
this.enable_index_contained_resource = enable_index_contained_resource;
}
public Boolean getEnable_repository_validating_interceptor() { public Boolean getEnable_repository_validating_interceptor() {
return enable_repository_validating_interceptor; return enable_repository_validating_interceptor;
} }
@@ -441,6 +453,23 @@ public class AppProperties {
this.normalized_quantity_search_level = normalized_quantity_search_level; this.normalized_quantity_search_level = normalized_quantity_search_level;
} }
public Integer getSearch_coord_core_pool_size() { return search_coord_core_pool_size; }
public void setSearch_coord_core_pool_size(Integer search_coord_core_pool_size) {
this.search_coord_core_pool_size = search_coord_core_pool_size;
}
public Integer getSearch_coord_max_pool_size() { return search_coord_max_pool_size; }
public void setSearch_coord_max_pool_size(Integer search_coord_max_pool_size) {
this.search_coord_max_pool_size = search_coord_max_pool_size;
}
public Integer getSearch_coord_queue_capacity() { return search_coord_queue_capacity; }
public void setSearch_coord_queue_capacity(Integer search_coord_queue_capacity) {
this.search_coord_queue_capacity = search_coord_queue_capacity;
}
public static class Cors { public static class Cors {
private Boolean allow_Credentials = true; private Boolean allow_Credentials = true;

View File

@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.cql.common.provider.CqlProviderLoader; import ca.uhn.fhir.cql.common.provider.CqlProviderLoader;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.IInterceptorService;
@@ -9,31 +10,38 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.provider.BulkDataExportProvider; import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor; import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
import ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson;
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider; import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
import ca.uhn.fhir.jpa.provider.*; import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.IJpaSystemProvider;
import ca.uhn.fhir.jpa.provider.JpaCapabilityStatementProvider;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
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.provider.r4.JpaConformanceProviderR4;
import ca.uhn.fhir.jpa.provider.r5.JpaConformanceProviderR5;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor; import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
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;
import ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy;
import ca.uhn.fhir.rest.server.ETagSupportEnum; import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy; import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
import ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy;
import ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy; import ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.*; import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.FhirPathFilterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor; import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory; import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy; import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.validation.IValidatorModule; 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;
@@ -44,73 +52,60 @@ import org.springframework.http.HttpHeaders;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import java.util.*; import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class BaseJpaRestfulServer extends RestfulServer { public class BaseJpaRestfulServer extends RestfulServer {
private static final long serialVersionUID = 1L;
@Autowired @Autowired
DaoRegistry daoRegistry; DaoRegistry daoRegistry;
@Autowired @Autowired
DaoConfig daoConfig; DaoConfig daoConfig;
@Autowired @Autowired
ISearchParamRegistry searchParamRegistry; ISearchParamRegistry searchParamRegistry;
@Autowired @Autowired
IFhirSystemDao fhirSystemDao; IFhirSystemDao fhirSystemDao;
@Autowired @Autowired
ResourceProviderFactory resourceProviders; ResourceProviderFactory resourceProviders;
@Autowired @Autowired
IJpaSystemProvider jpaSystemProvider; IJpaSystemProvider jpaSystemProvider;
@Autowired @Autowired
IInterceptorBroadcaster interceptorBroadcaster; IInterceptorBroadcaster interceptorBroadcaster;
@Autowired @Autowired
DatabaseBackedPagingProvider databaseBackedPagingProvider; DatabaseBackedPagingProvider databaseBackedPagingProvider;
@Autowired @Autowired
IInterceptorService interceptorService; IInterceptorService interceptorService;
@Autowired @Autowired
IValidatorModule validatorModule; IValidatorModule validatorModule;
@Autowired @Autowired
Optional<GraphQLProvider> graphQLProvider; Optional<GraphQLProvider> graphQLProvider;
@Autowired @Autowired
BulkDataExportProvider bulkDataExportProvider; BulkDataExportProvider bulkDataExportProvider;
@Autowired @Autowired
PartitionManagementProvider partitionManagementProvider; PartitionManagementProvider partitionManagementProvider;
@Autowired @Autowired
BinaryStorageInterceptor binaryStorageInterceptor; BinaryStorageInterceptor binaryStorageInterceptor;
@Autowired @Autowired
IPackageInstallerSvc packageInstallerSvc; IPackageInstallerSvc packageInstallerSvc;
@Autowired @Autowired
AppProperties appProperties; AppProperties appProperties;
@Autowired @Autowired
ApplicationContext myApplicationContext; ApplicationContext myApplicationContext;
@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; private CqlProviderLoader cqlProviderLoader;
@Autowired
private IValidationSupport myValidationSupport;
public BaseJpaRestfulServer() { public BaseJpaRestfulServer() {
} }
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
protected void initialize() throws ServletException { protected void initialize() throws ServletException {
@@ -158,14 +153,14 @@ public class BaseJpaRestfulServer extends RestfulServer {
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R4) { } else if (fhirVersion == FhirVersionEnum.R4) {
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, fhirSystemDao, JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, fhirSystemDao,
daoConfig, searchParamRegistry); daoConfig, searchParamRegistry, myValidationSupport);
confProvider.setImplementationDescription("HAPI FHIR R4 Server"); confProvider.setImplementationDescription("HAPI FHIR R4 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R5) { } else if (fhirVersion == FhirVersionEnum.R5) {
JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, fhirSystemDao, JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, fhirSystemDao,
daoConfig, searchParamRegistry); daoConfig, searchParamRegistry, myValidationSupport);
confProvider.setImplementationDescription("HAPI FHIR R5 Server"); confProvider.setImplementationDescription("HAPI FHIR R5 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else { } else {
@@ -384,5 +379,7 @@ public class BaseJpaRestfulServer extends RestfulServer {
} }
daoConfig.getModelConfig().setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level()); daoConfig.getModelConfig().setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
daoConfig.getModelConfig().setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
} }
} }

View File

@@ -61,6 +61,10 @@ public class FhirServerConfigCommon {
if (appProperties.getSubscription().getEmail() != null) { if (appProperties.getSubscription().getEmail() != null) {
ourLog.info("Email subscriptions enabled"); ourLog.info("Email subscriptions enabled");
} }
if (appProperties.getEnable_index_contained_resource() == Boolean.TRUE) {
ourLog.info("Indexed on contained resource enabled");
}
} }
/** /**
@@ -163,6 +167,8 @@ public class FhirServerConfigCommon {
} }
modelConfig.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level()); modelConfig.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
modelConfig.setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
return modelConfig; return modelConfig;
} }

View File

@@ -13,6 +13,7 @@ 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.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@@ -31,6 +32,19 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
@Autowired @Autowired
AppProperties appProperties; AppProperties appProperties;
@PostConstruct
public void initSettings() {
if(appProperties.getSearch_coord_core_pool_size() != null) {
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
}
if(appProperties.getSearch_coord_max_pool_size() != null) {
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
}
if(appProperties.getSearch_coord_queue_capacity() != null) {
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
}
}
@Override @Override
public DatabaseBackedPagingProvider databaseBackedPagingProvider() { public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider(); DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();

View File

@@ -11,6 +11,7 @@ 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.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@@ -29,6 +30,20 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
@Autowired @Autowired
AppProperties appProperties; AppProperties appProperties;
@PostConstruct
public void initSettings() {
if(appProperties.getSearch_coord_core_pool_size() != null) {
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
}
if(appProperties.getSearch_coord_max_pool_size() != null) {
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
}
if(appProperties.getSearch_coord_queue_capacity() != null) {
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
}
}
@Override @Override
public DatabaseBackedPagingProvider databaseBackedPagingProvider() { public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider(); DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
@@ -68,7 +83,12 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
public ElasticsearchSvcImpl elasticsearchSvc() { public ElasticsearchSvcImpl elasticsearchSvc() {
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) { if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment); String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":")); String elasticsearchHost;
if (elasticsearchUrl.startsWith("http")) {
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
} else {
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
}
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment); String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment); String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1)); int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));

View File

@@ -12,6 +12,7 @@ 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.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@@ -31,6 +32,19 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
@Autowired @Autowired
AppProperties appProperties; AppProperties appProperties;
@PostConstruct
public void initSettings() {
if(appProperties.getSearch_coord_core_pool_size() != null) {
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
}
if(appProperties.getSearch_coord_max_pool_size() != null) {
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
}
if(appProperties.getSearch_coord_queue_capacity() != null) {
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
}
}
@Override @Override
public DatabaseBackedPagingProvider databaseBackedPagingProvider() { public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider(); DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();

View File

@@ -14,6 +14,7 @@ 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.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@@ -32,6 +33,19 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
@Autowired @Autowired
AppProperties appProperties; AppProperties appProperties;
@PostConstruct
public void initSettings() {
if(appProperties.getSearch_coord_core_pool_size() != null) {
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
}
if(appProperties.getSearch_coord_max_pool_size() != null) {
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
}
if(appProperties.getSearch_coord_queue_capacity() != null) {
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
}
}
@Override @Override
public DatabaseBackedPagingProvider databaseBackedPagingProvider() { public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider(); DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
@@ -71,7 +85,12 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
public ElasticsearchSvcImpl elasticsearchSvc() { public ElasticsearchSvcImpl elasticsearchSvc() {
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) { if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment); String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":")); String elasticsearchHost;
if (elasticsearchUrl.startsWith("http")) {
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
} else {
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
}
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment); String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment); String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1)); int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));

View File

@@ -6,24 +6,28 @@ spring:
password: null password: null
driverClassName: org.h2.Driver driverClassName: org.h2.Driver
max-active: 15 max-active: 15
# database connection pool size
hikari:
maximum-pool-size: 10
jpa: jpa:
properties: properties:
hibernate.format_sql: false hibernate.format_sql: false
hibernate.show_sql: false hibernate.show_sql: false
# hibernate.dialect: org.hibernate.dialect.h2dialect # hibernate.dialect: org.hibernate.dialect.h2dialect
# hibernate.hbm2ddl.auto: update # hibernate.hbm2ddl.auto: update
# hibernate.jdbc.batch_size: 20 # hibernate.jdbc.batch_size: 20
# hibernate.cache.use_query_cache: false # hibernate.cache.use_query_cache: false
# hibernate.cache.use_second_level_cache: false # hibernate.cache.use_second_level_cache: false
# hibernate.cache.use_structured_entries: false # hibernate.cache.use_structured_entries: false
# hibernate.cache.use_minimal_puts: false # hibernate.cache.use_minimal_puts: false
### These settings will enable fulltext search with lucene ### These settings will enable fulltext search with lucene
# hibernate.search.enabled: true # hibernate.search.enabled: true
# hibernate.search.backend.type: lucene # hibernate.search.backend.type: lucene
# hibernate.search.backend.analysis.configurer: ca.uhn.fhir.jpa.search.HapiLuceneAnalysisConfigurer # hibernate.search.backend.analysis.configurer: ca.uhn.fhir.jpa.search.HapiLuceneAnalysisConfigurer
# hibernate.search.backend.directory.type: local-filesystem # hibernate.search.backend.directory.type: local-filesystem
# hibernate.search.backend.directory.root: target/lucenefiles # hibernate.search.backend.directory.root: target/lucenefiles
# hibernate.search.backend.lucene_version: lucene_current # hibernate.search.backend.lucene_version: lucene_current
batch: batch:
job: job:
enabled: false enabled: false
@@ -31,83 +35,90 @@ hapi:
fhir: fhir:
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5 ### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
fhir_version: R4 fhir_version: R4
### enable to use the ApacheProxyAddressStrategy which uses X-Forwarded-* headers ### enable to use the ApacheProxyAddressStrategy which uses X-Forwarded-* headers
### to determine the FHIR server address ### to determine the FHIR server address
# use_apache_address_strategy: false # use_apache_address_strategy: false
### forces the use of the https:// protocol for the returned server address. ### forces the use of the https:// protocol for the returned server address.
### alternatively, it may be set using the X-Forwarded-Proto header. ### alternatively, it may be set using the X-Forwarded-Proto header.
# use_apache_address_strategy_https: false # use_apache_address_strategy_https: false
### enable to set the Server URL ### enable to set the Server URL
# server_address: http://hapi.fhir.org/baseR4 # server_address: http://hapi.fhir.org/baseR4
# defer_indexing_for_codesystems_of_size: 101 # defer_indexing_for_codesystems_of_size: 101
# implementationguides: # implementationguides:
### example from registry (packages.fhir.org) ### example from registry (packages.fhir.org)
# swiss: # swiss:
# name: swiss.mednet.fhir # name: swiss.mednet.fhir
# version: 0.8.0 # version: 0.8.0
# example not from registry # example not from registry
# ips_1_0_0: # ips_1_0_0:
# url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz # url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz
# name: hl7.fhir.uv.ips # name: hl7.fhir.uv.ips
# version: 1.0.0 # version: 1.0.0
# supported_resource_types: # supported_resource_types:
# - Patient # - Patient
# - Observation # - Observation
# allow_cascading_deletes: true # allow_cascading_deletes: true
# allow_contains_searches: true # allow_contains_searches: true
# allow_external_references: true # allow_external_references: true
# allow_multiple_delete: true # allow_multiple_delete: true
# allow_override_default_search_params: true # allow_override_default_search_params: true
# allow_placeholder_references: true # allow_placeholder_references: true
# auto_create_placeholder_reference_targets: false # auto_create_placeholder_reference_targets: false
# cql_enabled: true # cql_enabled: true
# default_encoding: JSON # default_encoding: JSON
# default_pretty_print: true # default_pretty_print: true
# default_page_size: 20 # default_page_size: 20
# enable_repository_validating_interceptor: false # enable_repository_validating_interceptor: false
# enable_index_missing_fields: false # enable_index_missing_fields: false
# enforce_referential_integrity_on_delete: false # enable_index_contained_resource: false
# enforce_referential_integrity_on_write: false # enforce_referential_integrity_on_delete: false
# etag_support_enabled: true # enforce_referential_integrity_on_write: false
# expunge_enabled: true # etag_support_enabled: true
# daoconfig_client_id_strategy: null # expunge_enabled: true
# client_id_strategy: ALPHANUMERIC # daoconfig_client_id_strategy: null
# fhirpath_interceptor_enabled: false # client_id_strategy: ALPHANUMERIC
# filter_search_enabled: true # fhirpath_interceptor_enabled: false
# graphql_enabled: true # filter_search_enabled: true
# narrative_enabled: true # graphql_enabled: true
# partitioning: # narrative_enabled: true
# allow_references_across_partitions: false # partitioning:
# partitioning_include_in_search_hashes: false # allow_references_across_partitions: false
cors: # partitioning_include_in_search_hashes: false
allow_Credentials: true cors:
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List- allow_Credentials: true
allowed_origin: # These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
- '*' allowed_origin:
# logger: - '*'
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
# format: >- # Search coordinator thread pool sizes
# Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] search-coord-core-pool-size: 20
# Operation[${operationType} ${operationName} ${idOrResourceName}] search-coord-max-pool-size: 100
# UA[${requestHeader.user-agent}] Params[${requestParameters}] search-coord-queue-capacity: 200
# ResponseEncoding[${responseEncodingNoDefault}]
# log_exceptions: true # logger:
# name: fhirtest.access # error_format: 'ERROR - ${requestVerb} ${requestUrl}'
# max_binary_size: 104857600 # format: >-
# max_page_size: 200 # Path[${servletPath}] Source[${requestHeader.x-forwarded-for}]
# retain_cached_searches_mins: 60 # Operation[${operationType} ${operationName} ${idOrResourceName}]
# reuse_cached_search_results_millis: 60000 # UA[${requestHeader.user-agent}] Params[${requestParameters}]
# ResponseEncoding[${responseEncodingNoDefault}]
# log_exceptions: true
# name: fhirtest.access
# max_binary_size: 104857600
# max_page_size: 200
# retain_cached_searches_mins: 60
# reuse_cached_search_results_millis: 60000
tester: tester:
home: home:
name: Local Tester name: Local Tester
server_address: 'http://localhost:8080/fhir' server_address: 'http://localhost:8080/fhir'
refuse_to_fetch_third_party_urls: false refuse_to_fetch_third_party_urls: false
fhir_version: R4 fhir_version: R4
global: global:
name: Global Tester name: Global Tester
server_address: "http://hapi.fhir.org/baseR4" server_address: "http://hapi.fhir.org/baseR4"
refuse_to_fetch_third_party_urls: false refuse_to_fetch_third_party_urls: false
fhir_version: R4 fhir_version: R4
# validation: # validation:
# requests_enabled: true # requests_enabled: true
# responses_enabled: true # responses_enabled: true

View File

@@ -60,7 +60,7 @@ public class ElasticsearchLastNR4IT {
private IGenericClient ourClient; private IGenericClient ourClient;
private FhirContext ourCtx; private FhirContext ourCtx;
private static final String ELASTIC_VERSION = "7.10.1"; private static final String ELASTIC_VERSION = "7.10.2";
private static final String ELASTIC_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch:" + ELASTIC_VERSION; private static final String ELASTIC_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch:" + ELASTIC_VERSION;
private static ElasticsearchContainer embeddedElastic; private static ElasticsearchContainer embeddedElastic;

View File

@@ -67,16 +67,18 @@ public class ExampleServerR5IT {
public void testWebsocketSubscription() throws Exception { public void testWebsocketSubscription() throws Exception {
/* /*
* Create topic * Create topic (will be contained in subscription)
*/ */
SubscriptionTopic topic = new SubscriptionTopic(); SubscriptionTopic topic = new SubscriptionTopic();
topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final"); topic.setId("#1");
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent("Observation?status=final");
/* /*
* Create subscription * Create subscription
*/ */
Subscription subscription = new Subscription(); Subscription subscription = new Subscription();
subscription.getTopic().setResource(topic); subscription.getContained().add(topic);
subscription.setTopic("#1");
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)"); subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
subscription.setStatus(Enumerations.SubscriptionState.REQUESTED); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
subscription.getChannelType() subscription.getChannelType()