From f0a8659653aeaa3cb34f38ae22f52cbe9dfc982e Mon Sep 17 00:00:00 2001 From: Tadgh Date: Sat, 4 Sep 2021 23:55:03 -0400 Subject: [PATCH 1/9] Fix template and setup static prefix as sample --- .../ca/uhn/fhir/jpa/api/config/DaoConfig.java | 30 +++++++- .../ca/uhn/fhir/jpa/config/BaseConfig.java | 6 ++ ...asticsearchHibernatePropertiesBuilder.java | 5 +- .../IndexNamePrefixLayoutStrategy.java | 73 +++++++++++++++++++ .../ca/uhn/fhir/jpa/config/TestJPAConfig.java | 7 ++ .../ca/uhn/fhir/jpa/config/TestR4Config.java | 6 ++ .../config/TestR4ConfigWithElasticSearch.java | 5 ++ .../TestR4WithLuceneDisabledConfig.java | 1 + .../java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 2 - ...esourceDaoR4SearchWithElasticSearchIT.java | 1 + .../uhn/fhir/jpa/test/FhirServerConfig.java | 2 - 11 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java diff --git a/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java b/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java index 5304478767d..ca9b5969021 100644 --- a/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java +++ b/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java @@ -258,6 +258,11 @@ public class DaoConfig { private boolean myAccountForDateIndexNulls; private boolean myTriggerSubscriptionsForNonVersioningChanges; + /** + * @since 5.6.0 + */ + private String myElasicSearchIndexPrefix; + /** * @since 5.6.0 */ @@ -269,6 +274,7 @@ public class DaoConfig { private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE; private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE; + /** * Constructor */ @@ -2643,7 +2649,29 @@ public class DaoConfig { return retval; } - public enum StoreMetaSourceInformationEnum { + /** + * + * Sets a prefix for any indexes created when interacting with elasticsearch. This will apply to fulltext search indexes + * and terminology expansion indexes. + * + * @since 5.6.0 + */ + public String getElasticSearchIndexPrefix() { + return myElasicSearchIndexPrefix; + } + + /** + * + * Sets a prefix for any indexes created when interacting with elasticsearch. This will apply to fulltext search indexes + * and terminology expansion indexes. + * + * @since 5.6.0 + */ + public void setElasticSearchIndexPrefix(String thePrefix) { + myElasicSearchIndexPrefix = thePrefix; + } + + public enum StoreMetaSourceInformationEnum { NONE(false, false), SOURCE_URI(true, false), REQUEST_ID(false, true), diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index 2aebff2b539..0bd2e393a4a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -121,6 +121,7 @@ import ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl; import ca.uhn.fhir.jpa.search.cache.DatabaseSearchResultCacheSvcImpl; import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc; import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc; +import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; import ca.uhn.fhir.jpa.search.reindex.ResourceReindexer; import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; @@ -911,6 +912,11 @@ public abstract class BaseConfig { return new PredicateBuilderFactory(theApplicationContext); } + @Bean + public IndexNamePrefixLayoutStrategy indexNamePrefixLayoutStrategy() { + return new IndexNamePrefixLayoutStrategy(); + } + @Bean public JpaResourceLoader jpaResourceLoader() { return new JpaResourceLoader(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/ElasticsearchHibernatePropertiesBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/ElasticsearchHibernatePropertiesBuilder.java index c0c75adac98..165b0478489 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/ElasticsearchHibernatePropertiesBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/ElasticsearchHibernatePropertiesBuilder.java @@ -99,6 +99,9 @@ public class ElasticsearchHibernatePropertiesBuilder { theProperties.put(HibernateOrmMapperSettings.AUTOMATIC_INDEXING_SYNCHRONIZATION_STRATEGY, myDebugSyncStrategy); theProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LOG_JSON_PRETTY_PRINTING), Boolean.toString(myDebugPrettyPrintJsonLog)); + //This tells elasticsearch to use our custom index naming strategy. + theProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName()); + injectStartupTemplate(myProtocol, myRestUrl, myUsername, myPassword); } @@ -149,7 +152,7 @@ public class ElasticsearchHibernatePropertiesBuilder { */ void injectStartupTemplate(String theProtocol, String theHostAndPort, String theUsername, String thePassword) { PutIndexTemplateRequest ngramTemplate = new PutIndexTemplateRequest("ngram-template") - .patterns(Arrays.asList("resourcetable-*", "termconcept-*")) + .patterns(Arrays.asList("*resourcetable-*", "*termconcept-*")) .settings(Settings.builder().put("index.max_ngram_diff", 50)); int colonIndex = theHostAndPort.indexOf(":"); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java new file mode 100644 index 00000000000..8a5636c21b3 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java @@ -0,0 +1,73 @@ +package ca.uhn.fhir.jpa.search.elastic; + +import ca.uhn.fhir.jpa.api.config.DaoConfig; +import org.apache.commons.lang3.StringUtils; +import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; +import org.hibernate.search.backend.elasticsearch.logging.impl.Log; +import org.hibernate.search.util.common.logging.impl.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.invoke.MethodHandles; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This class instructs hibernate search on how to create index names for indexed entities. + * In our case, we use this class to add an optional prefix to all indices which are created, which can be controlled via + * {@link DaoConfig#setElasticSearchIndexPrefix(String)}. + */ +@Service +public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { + +// @Autowired +// private DaoConfig myDaoConfig; + + static final Log log = (Log) LoggerFactory.make(Log.class, MethodHandles.lookup()); + public static final String NAME = "prefix"; + public static final Pattern UNIQUE_KEY_EXTRACTION_PATTERN = Pattern.compile("(.*)-\\d{6}"); + + public String createInitialElasticsearchIndexName(String hibernateSearchIndexName) { + return addPrefixIfNecessary(hibernateSearchIndexName + "-000001"); + } + + public String createWriteAlias(String hibernateSearchIndexName) { + return addPrefixIfNecessary(hibernateSearchIndexName +"-write"); + } + + public String createReadAlias(String hibernateSearchIndexName) { + return addPrefixIfNecessary(hibernateSearchIndexName + "-read"); + } + + private String addPrefixIfNecessary(String theCandidateName) { + String myDaoConfig = "zoop"; + if (!StringUtils.isBlank(myDaoConfig)) { + return myDaoConfig + "-" + theCandidateName; + } else { + return theCandidateName; + } + } + + public String extractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName) { + return hibernateSearchIndexName; + } + + public String extractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName) { + Matcher matcher = UNIQUE_KEY_EXTRACTION_PATTERN.matcher(elasticsearchIndexName); + if (!matcher.matches()) { + throw log.invalidIndexPrimaryName(elasticsearchIndexName, UNIQUE_KEY_EXTRACTION_PATTERN); + } else { + String candidateUniqueKey= matcher.group(1); + return removePrefixIfNecessary(candidateUniqueKey); + } + } + + private String removePrefixIfNecessary(String theCandidateUniqueKey) { + String myDaoConfig = "zoop"; + if (!StringUtils.isBlank(myDaoConfig)) { + return theCandidateUniqueKey.replace(myDaoConfig+ "-", ""); + } else { + return theCandidateUniqueKey; + } + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java index 6cd511805e6..c3946a7e333 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java @@ -3,12 +3,14 @@ package ca.uhn.fhir.jpa.config; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil; 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.deliver.resthook.SubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig; import ca.uhn.fhir.test.utilities.BatchJobHelper; +import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; import org.springframework.batch.core.explore.JobExplorer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -31,6 +33,11 @@ public class TestJPAConfig { return new DaoConfig(); } + @Bean + public IndexNamePrefixLayoutStrategy indexNamePrefixLayoutStrategy() { + return new IndexNamePrefixLayoutStrategy(); + } + @Bean public PartitionSettings partitionSettings() { return new PartitionSettings(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index 8d66111219b..241d4bf7b98 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; +import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; @@ -14,6 +15,7 @@ import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; import org.apache.commons.dbcp2.BasicDataSource; import org.hibernate.dialect.H2Dialect; +import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -148,6 +150,10 @@ public class TestR4Config extends BaseJavaConfigR4 { return retVal; } + @Bean + public IndexLayoutStrategy indexPrefixLayout() { + return new IndexNamePrefixLayoutStrategy(); + } @Bean public Properties jpaProperties() { Properties extraProperties = new Properties(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java index 81a5bc6a293..e5fbd33786b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java @@ -1,11 +1,16 @@ package ca.uhn.fhir.jpa.config; +import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.search.elastic.ElasticsearchHibernatePropertiesBuilder; +import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper; +import org.h2.index.Index; import org.hibernate.search.backend.elasticsearch.index.IndexStatus; +import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.testcontainers.elasticsearch.ElasticsearchContainer; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java index f0e4fc6f0b3..046563d8027 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java @@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.config; import java.util.Properties; import org.hibernate.dialect.H2Dialect; +import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; import org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings; import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java index 03f223efa2d..3a33c57abdd 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -721,6 +721,4 @@ public abstract class BaseJpaTest extends BaseTest { } Thread.sleep(500); } - - } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java index 79904f2d15f..263e99760fb 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java @@ -106,6 +106,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest { @BeforeEach public void beforePurgeDatabase() { purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataExportSvc); + myDaoConfig.setElasticSearchIndexPrefix("ZOOP"); } @Override diff --git a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java index abed389fb35..baf895604f9 100644 --- a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java +++ b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java @@ -18,6 +18,4 @@ public class FhirServerConfig { DaoConfig retVal = new DaoConfig(); return retVal; } - - } From 710fb3bd8951c0649d1f27dc1f6760b6fd8535fa Mon Sep 17 00:00:00 2001 From: Tadgh Date: Sun, 5 Sep 2021 00:04:13 -0400 Subject: [PATCH 2/9] wip --- .../java/ca/uhn/fhir/jpa/config/BaseConfig.java | 2 +- .../elastic/IndexNamePrefixLayoutStrategy.java | 15 +++++++-------- .../jpa/config/TestR4ConfigWithElasticSearch.java | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index 0bd2e393a4a..7416f1c564c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -913,7 +913,7 @@ public abstract class BaseConfig { } @Bean - public IndexNamePrefixLayoutStrategy indexNamePrefixLayoutStrategy() { + public IndexNamePrefixLayoutStrategy indexLayoutStrategy() { return new IndexNamePrefixLayoutStrategy(); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java index 8a5636c21b3..9f5f48f37af 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java @@ -20,8 +20,8 @@ import java.util.regex.Pattern; @Service public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { -// @Autowired -// private DaoConfig myDaoConfig; + @Autowired + private DaoConfig myDaoConfig; static final Log log = (Log) LoggerFactory.make(Log.class, MethodHandles.lookup()); public static final String NAME = "prefix"; @@ -40,9 +40,9 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { } private String addPrefixIfNecessary(String theCandidateName) { - String myDaoConfig = "zoop"; - if (!StringUtils.isBlank(myDaoConfig)) { - return myDaoConfig + "-" + theCandidateName; + + if (!StringUtils.isBlank(myDaoConfig.getElasticSearchIndexPrefix())) { + return myDaoConfig.getElasticSearchIndexPrefix() + "-" + theCandidateName; } else { return theCandidateName; } @@ -63,9 +63,8 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { } private String removePrefixIfNecessary(String theCandidateUniqueKey) { - String myDaoConfig = "zoop"; - if (!StringUtils.isBlank(myDaoConfig)) { - return theCandidateUniqueKey.replace(myDaoConfig+ "-", ""); + if (!StringUtils.isBlank(myDaoConfig.getElasticSearchIndexPrefix())) { + return theCandidateUniqueKey.replace(myDaoConfig.getElasticSearchIndexPrefix() + "-", ""); } else { return theCandidateUniqueKey; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java index e5fbd33786b..2e358abe4ec 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4ConfigWithElasticSearch.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; import org.testcontainers.elasticsearch.ElasticsearchContainer; import javax.annotation.PreDestroy; From ad5d56172a1b4bab639bdf2f08a19051d6bcf25b Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 09:11:48 -0400 Subject: [PATCH 3/9] Return 2 unused beans --- .../src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java | 5 ----- .../src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java | 4 ---- 2 files changed, 9 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java index c3946a7e333..660c76e7556 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestJPAConfig.java @@ -33,11 +33,6 @@ public class TestJPAConfig { return new DaoConfig(); } - @Bean - public IndexNamePrefixLayoutStrategy indexNamePrefixLayoutStrategy() { - return new IndexNamePrefixLayoutStrategy(); - } - @Bean public PartitionSettings partitionSettings() { return new PartitionSettings(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index 241d4bf7b98..12c49878415 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -150,10 +150,6 @@ public class TestR4Config extends BaseJavaConfigR4 { return retVal; } - @Bean - public IndexLayoutStrategy indexPrefixLayout() { - return new IndexNamePrefixLayoutStrategy(); - } @Bean public Properties jpaProperties() { Properties extraProperties = new Properties(); From ca2a1ff9dfe982cac472dc13d6ea2d7528493f2f Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 10:08:17 -0400 Subject: [PATCH 4/9] Add HsTest replicating boot failure --- .../ca/uhn/fhir/jpa/config/TestR4Config.java | 11 +- .../ca/uhn/fhir/jpa/dao/r4/DummyConfig.java | 117 ++++++++++++++++++ ...esourceDaoR4SearchWithElasticSearchIT.java | 8 +- .../java/ca/uhn/fhir/jpa/dao/r4/HsTest.java | 19 +++ 4 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index 12c49878415..2f70b366993 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -1,11 +1,11 @@ package ca.uhn.fhir.jpa.config; +import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.batch.BatchJobsConfig; import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; -import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; @@ -15,7 +15,7 @@ import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; import org.apache.commons.dbcp2.BasicDataSource; import org.hibernate.dialect.H2Dialect; -import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; +import org.hibernate.jpa.HibernatePersistenceProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -140,10 +140,15 @@ public class TestR4Config extends BaseJavaConfigR4 { return new SingleQueryCountHolder(); } + @Override @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(); + configureEntityManagerFactory(retVal, fhirContext()); + retVal.setJpaDialect(new HapiFhirHibernateJpaDialect(fhirContext().getLocalizer())); + retVal.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity"); + retVal.setPersistenceProvider(new HibernatePersistenceProvider()); retVal.setPersistenceUnitName("PU_HapiFhirJpaR4"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java new file mode 100644 index 00000000000..9bb8ae2fb7c --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java @@ -0,0 +1,117 @@ +package ca.uhn.fhir.jpa.dao.r4; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.config.BlockLargeNumbersOfParamsListener; +import ca.uhn.fhir.jpa.config.HapiFhirHibernateJpaDialect; +import ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean; +import ca.uhn.fhir.jpa.search.elastic.HapiElasticsearchAnalysisConfigurer; +import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; +import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper; +import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; +import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; +import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; +import org.apache.commons.dbcp2.BasicDataSource; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.jpa.HibernatePersistenceProvider; +import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings; +import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchIndexSettings; +import org.hibernate.search.backend.elasticsearch.index.IndexStatus; +import org.hibernate.search.engine.cfg.BackendSettings; +import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; +import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.testcontainers.elasticsearch.ElasticsearchContainer; + +import javax.sql.DataSource; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +@Configuration +public class DummyConfig { + + @Bean + public DaoConfig daoConfig() { + return new DaoConfig(); + } + + @Bean + public IndexNamePrefixLayoutStrategy indexNamePrefixLayoutStrategy() { + return new IndexNamePrefixLayoutStrategy(); + } + @Bean + public FhirContext fhirContext() { + return FhirContext.forR4(); + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(); + retVal.setJpaDialect(new HapiFhirHibernateJpaDialect(fhirContext().getLocalizer())); + retVal.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity"); + retVal.setPersistenceProvider(new HibernatePersistenceProvider()); + retVal.setPersistenceUnitName("PU_HapiFhirJpaR4"); + retVal.setDataSource(dataSource()); + retVal.setJpaProperties(jpaProperties()); + return retVal; + } + @Bean + public DataSource dataSource() { + BasicDataSource retVal = new BasicDataSource(); + retVal.setDriver(new org.h2.Driver()); + retVal.setUrl("jdbc:h2:mem:testdb_r4"); + retVal.setMaxWaitMillis(30000); + retVal.setUsername(""); + retVal.setPassword(""); + retVal.setMaxTotal(5); + + SLF4JLogLevel level = SLF4JLogLevel.INFO; + DataSource dataSource = ProxyDataSourceBuilder + .create(retVal) + .logSlowQueryBySlf4j(10, TimeUnit.SECONDS, level) + .beforeQuery(new BlockLargeNumbersOfParamsListener()) + .afterQuery(new CurrentThreadCaptureQueriesListener()) + .build(); + + return dataSource; + } + + @Bean + public Properties jpaProperties() { + Properties extraProperties = new Properties(); + extraProperties.put("hibernate.format_sql", "false"); + extraProperties.put("hibernate.show_sql", "false"); + extraProperties.put("hibernate.hbm2ddl.auto", "update"); + extraProperties.put("hibernate.dialect", H2Dialect.class.getName()); + //Override default lucene settings + // Force elasticsearch to start first + int httpPort = elasticContainer().getMappedPort(9200);//9200 is the HTTP port + String host = elasticContainer().getHost(); + // the below properties are used for ElasticSearch integration + extraProperties.put(BackendSettings.backendKey(BackendSettings.TYPE), "elasticsearch"); + extraProperties.put(BackendSettings.backendKey(ElasticsearchIndexSettings.ANALYSIS_CONFIGURER), HapiElasticsearchAnalysisConfigurer.class.getName()); + extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.HOSTS), host + ":" + httpPort); + extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.PROTOCOL), "http"); + extraProperties.put(HibernateOrmMapperSettings.SCHEMA_MANAGEMENT_STRATEGY, SchemaManagementStrategyName.CREATE.externalRepresentation()); + extraProperties.put(BackendSettings.backendKey(ElasticsearchIndexSettings.SCHEMA_MANAGEMENT_MINIMAL_REQUIRED_STATUS_WAIT_TIMEOUT), Long.toString(10000)); + extraProperties.put(BackendSettings.backendKey(ElasticsearchIndexSettings.SCHEMA_MANAGEMENT_MINIMAL_REQUIRED_STATUS), IndexStatus.YELLOW.externalRepresentation()); + // Need the mapping to be dynamic because of terminology indexes. + extraProperties.put(BackendSettings.backendKey(ElasticsearchIndexSettings.DYNAMIC_MAPPING), "true"); + // Only for unit tests + extraProperties.put(HibernateOrmMapperSettings.AUTOMATIC_INDEXING_SYNCHRONIZATION_STRATEGY, "read-sync"); + extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LOG_JSON_PRETTY_PRINTING), Boolean.toString(true)); + + //This tells elasticsearch to use our custom index naming strategy. + extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName()); + return extraProperties; + } + + @Bean + public ElasticsearchContainer elasticContainer() { + ElasticsearchContainer embeddedElasticSearch = TestElasticsearchContainerHelper.getEmbeddedElasticSearch(); + embeddedElasticSearch.start(); + return embeddedElasticSearch; + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java index 263e99760fb..32bf359a0d6 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java @@ -9,11 +9,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import java.util.stream.Collectors; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; +import ca.uhn.fhir.jpa.search.elastic.ElasticsearchHibernatePropertiesBuilder; import ca.uhn.fhir.test.utilities.docker.RequiresDocker; import org.hamcrest.Matchers; +import org.hibernate.search.backend.elasticsearch.index.IndexStatus; +import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.CodeSystem; @@ -28,6 +32,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -342,6 +348,4 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest { } - - } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java new file mode 100644 index 00000000000..23fffb8a252 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java @@ -0,0 +1,19 @@ +package ca.uhn.fhir.jpa.dao.r4; + +import ca.uhn.fhir.test.utilities.docker.RequiresDocker; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +@RequiresDocker +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = {DummyConfig.class}) +public class HsTest { + + @Test + public void test() { + System.out.println("zoop"); + } + +} From 16752f393c5927f988332d825d676286f3c626e7 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 13:33:03 -0400 Subject: [PATCH 5/9] Finalize implementation --- .../uhn/fhir/jpa/demo/FhirServerConfig.java | 5 +- .../fhir/jpa/demo/FhirServerConfigDstu3.java | 5 +- .../uhn/fhir/jpa/demo/FhirServerConfigR4.java | 5 +- .../ca/uhn/fhir/jpa/config/BaseConfig.java | 5 +- ...ocalContainerEntityManagerFactoryBean.java | 16 ++++++ .../ElasticsearchWithPrefixConfig.java} | 40 +++++++++++++-- .../uhn/fhir/jpa/config/TestDstu2Config.java | 5 +- .../uhn/fhir/jpa/config/TestDstu3Config.java | 5 +- .../ca/uhn/fhir/jpa/config/TestR4Config.java | 5 +- .../TestR4WithLuceneDisabledConfig.java | 5 +- .../ca/uhn/fhir/jpa/config/TestR5Config.java | 5 +- .../jpa/dao/r4/ElasticsearchPrefixTest.java | 49 +++++++++++++++++++ ...esourceDaoR4SearchWithElasticSearchIT.java | 1 - .../java/ca/uhn/fhir/jpa/dao/r4/HsTest.java | 19 ------- .../fhir/jpa/config/TestJpaDstu3Config.java | 5 +- .../uhn/fhir/jpa/config/TestJpaR4Config.java | 5 +- .../uhn/fhirtest/config/TestDstu2Config.java | 5 +- .../uhn/fhirtest/config/TestDstu3Config.java | 5 +- .../ca/uhn/fhirtest/config/TestR4Config.java | 5 +- .../ca/uhn/fhirtest/config/TestR5Config.java | 5 +- 20 files changed, 145 insertions(+), 55 deletions(-) rename hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/{dao/r4/DummyConfig.java => config/ElasticsearchWithPrefixConfig.java} (73%) create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java delete mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java index ee145f02902..82f2c161c13 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -65,8 +66,8 @@ public class FhirServerConfig extends BaseJavaConfigDstu2 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("HAPI_PU"); retVal.setDataSource(myDataSource); retVal.setJpaProperties(myJpaProperties); diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigDstu3.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigDstu3.java index e27f4742efc..23eec567a44 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigDstu3.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigDstu3.java @@ -30,6 +30,7 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -62,8 +63,8 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("HAPI_PU"); retVal.setDataSource(myDataSource); retVal.setJpaProperties(myJpaProperties); diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java index 657cd97b347..701c9e9aa2a 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java @@ -28,6 +28,7 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -60,8 +61,8 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("HAPI_PU"); retVal.setDataSource(myDataSource); retVal.setJpaProperties(myJpaProperties); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index 7416f1c564c..34ab8f2212f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -153,6 +153,7 @@ import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; import org.springframework.batch.core.configuration.annotation.BatchConfigurer; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -286,8 +287,8 @@ public abstract class BaseConfig { * bean, but it provides a partially completed entity manager * factory with HAPI FHIR customizations */ - protected LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(); + protected LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory myConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(myConfigurableListableBeanFactory); configureEntityManagerFactory(retVal, fhirContext()); return retVal; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java index 56512d2dd4b..e9140c55d66 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java @@ -23,6 +23,9 @@ package ca.uhn.fhir.jpa.config; import org.hibernate.cfg.AvailableSettings; import org.hibernate.query.criteria.LiteralHandlingMode; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.orm.hibernate5.SpringBeanContainer; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import java.util.Map; @@ -32,6 +35,14 @@ import java.util.Map; * that sets some sensible default property values */ public class HapiFhirLocalContainerEntityManagerFactoryBean extends LocalContainerEntityManagerFactoryBean { + + //Weeeeee : https://stackoverflow.com/questions/57902388/how-to-inject-spring-beans-into-the-hibernate-envers-revisionlistener + ConfigurableListableBeanFactory myConfigurableListableBeanFactory; + + public HapiFhirLocalContainerEntityManagerFactoryBean(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + myConfigurableListableBeanFactory = theConfigurableListableBeanFactory; + } + @Override public Map getJpaPropertyMap() { Map retVal = super.getJpaPropertyMap(); @@ -63,6 +74,11 @@ public class HapiFhirLocalContainerEntityManagerFactoryBean extends LocalContain if (!retVal.containsKey(AvailableSettings.BATCH_VERSIONED_DATA)) { retVal.put(AvailableSettings.BATCH_VERSIONED_DATA, "true"); } + //Why is this here, you ask? LocalContainerEntityManagerFactoryBean actually clobbers the setting hibernate needs + //in order to be able to resolve beans, so we add it back in manually here: + if (!retVal.containsKey(AvailableSettings.BEAN_CONTAINER)) { + retVal.put(AvailableSettings.BEAN_CONTAINER, new SpringBeanContainer(myConfigurableListableBeanFactory)); + } return retVal; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java similarity index 73% rename from hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java rename to hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java index 9bb8ae2fb7c..5789ee204dc 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/DummyConfig.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java @@ -1,17 +1,25 @@ -package ca.uhn.fhir.jpa.dao.r4; +package ca.uhn.fhir.jpa.config; +import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.config.BlockLargeNumbersOfParamsListener; import ca.uhn.fhir.jpa.config.HapiFhirHibernateJpaDialect; import ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean; +import ca.uhn.fhir.jpa.dao.r4.ElasticsearchPrefixTest; import ca.uhn.fhir.jpa.search.elastic.HapiElasticsearchAnalysisConfigurer; import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; +import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory; import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; import org.apache.commons.dbcp2.BasicDataSource; +import org.elasticsearch.action.support.master.AcknowledgedResponse; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestHighLevelClient; +import org.elasticsearch.client.indices.PutIndexTemplateRequest; +import org.elasticsearch.common.settings.Settings; import org.hibernate.dialect.H2Dialect; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings; @@ -20,21 +28,30 @@ import org.hibernate.search.backend.elasticsearch.index.IndexStatus; import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.testcontainers.elasticsearch.ElasticsearchContainer; import javax.sql.DataSource; +import java.io.IOException; +import java.util.Arrays; import java.util.Properties; import java.util.concurrent.TimeUnit; +/** + * The only reason this is its own class is so that we can set a dao config setting before the whole test framework comes online. + * We need to do this as it is during bean creation that HS bootstrapping occurs. + */ @Configuration -public class DummyConfig { +public class ElasticsearchWithPrefixConfig { @Bean public DaoConfig daoConfig() { - return new DaoConfig(); + DaoConfig daoConfig = new DaoConfig(); + daoConfig.setElasticSearchIndexPrefix(ElasticsearchPrefixTest.ELASTIC_PREFIX); + return daoConfig; } @Bean @@ -47,8 +64,8 @@ public class DummyConfig { } @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(theConfigurableListableBeanFactory); retVal.setJpaDialect(new HapiFhirHibernateJpaDialect(fhirContext().getLocalizer())); retVal.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity"); retVal.setPersistenceProvider(new HibernatePersistenceProvider()); @@ -105,6 +122,19 @@ public class DummyConfig { //This tells elasticsearch to use our custom index naming strategy. extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName()); + + PutIndexTemplateRequest ngramTemplate = new PutIndexTemplateRequest("ngram-template") + .patterns(Arrays.asList("*resourcetable-*", "*termconcept-*")) + .settings(Settings.builder().put("index.max_ngram_diff", 50)); + + try { + RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient("http://" + host, httpPort, "", ""); + AcknowledgedResponse acknowledgedResponse = elasticsearchHighLevelRestClient.indices().putTemplate(ngramTemplate, RequestOptions.DEFAULT); + assert acknowledgedResponse.isAcknowledged(); + } catch (IOException theE) { + theE.printStackTrace(); + throw new ConfigurationException("Couldn't connect to the elasticsearch server to create necessary templates. Ensure the Elasticsearch user has permissions to create templates."); + } return extraProperties; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java index 5eac45f795a..945e5511554 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java @@ -16,6 +16,7 @@ import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -134,8 +135,8 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu2"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java index a31d6638cb3..22fe68d67ce 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java @@ -15,6 +15,7 @@ import org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings; import org.hibernate.search.backend.lucene.cfg.LuceneIndexSettings; import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -138,8 +139,8 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu3"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index 2f70b366993..96256b04097 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -16,6 +16,7 @@ import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; import org.apache.commons.dbcp2.BasicDataSource; import org.hibernate.dialect.H2Dialect; import org.hibernate.jpa.HibernatePersistenceProvider; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -143,8 +144,8 @@ public class TestR4Config extends BaseJavaConfigR4 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(theConfigurableListableBeanFactory); configureEntityManagerFactory(retVal, fhirContext()); retVal.setJpaDialect(new HapiFhirHibernateJpaDialect(fhirContext().getLocalizer())); retVal.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity"); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java index 046563d8027..8786552e85c 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java @@ -7,6 +7,7 @@ import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrate import org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings; import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; @@ -28,8 +29,8 @@ public class TestR4WithLuceneDisabledConfig extends TestR4Config { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); return retVal; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java index 254c0c8a357..bdecf0f28e6 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java @@ -16,6 +16,7 @@ import org.hibernate.search.backend.lucene.cfg.LuceneIndexSettings; import org.hibernate.search.engine.cfg.BackendSettings; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -138,8 +139,8 @@ public class TestR5Config extends BaseJavaConfigR5 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaR5"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java new file mode 100644 index 00000000000..239eadda9e0 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java @@ -0,0 +1,49 @@ +package ca.uhn.fhir.jpa.dao.r4; + +import ca.uhn.fhir.jpa.config.ElasticsearchWithPrefixConfig; +import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory; +import ca.uhn.fhir.test.utilities.docker.RequiresDocker; +import org.apache.http.util.EntityUtils; +import org.elasticsearch.client.Request; +import org.elasticsearch.client.Response; +import org.elasticsearch.client.RestClient; +import org.elasticsearch.client.RestHighLevelClient; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.testcontainers.elasticsearch.ElasticsearchContainer; + +import java.io.IOException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; + +@RequiresDocker +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = {ElasticsearchWithPrefixConfig.class}) +public class ElasticsearchPrefixTest { + + @Autowired + ElasticsearchContainer elasticsearchContainer; + + public static String ELASTIC_PREFIX = "hapi-fhir"; + @Test + public void test() throws IOException { + //Given + RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient( + "http://" + elasticsearchContainer.getHost(), elasticsearchContainer.getMappedPort(9200), "", ""); + + //When + RestClient lowLevelClient = elasticsearchHighLevelRestClient.getLowLevelClient(); + Response get = lowLevelClient.performRequest(new Request("GET", "/_cat/indices")); + String catIndexes = EntityUtils.toString(get.getEntity()); + + //Then + assertThat(catIndexes, containsString(ELASTIC_PREFIX + "-resourcetable-000001")); + assertThat(catIndexes, containsString(ELASTIC_PREFIX + "-termconcept-000001")); + + } + +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java index 32bf359a0d6..d17dac8d803 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java @@ -112,7 +112,6 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest { @BeforeEach public void beforePurgeDatabase() { purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataExportSvc); - myDaoConfig.setElasticSearchIndexPrefix("ZOOP"); } @Override diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java deleted file mode 100644 index 23fffb8a252..00000000000 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/HsTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package ca.uhn.fhir.jpa.dao.r4; - -import ca.uhn.fhir.test.utilities.docker.RequiresDocker; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@RequiresDocker -@ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = {DummyConfig.class}) -public class HsTest { - - @Test - public void test() { - System.out.println("zoop"); - } - -} diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java index 08420e8727a..3ca64e792b3 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java @@ -41,6 +41,7 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Lazy; @@ -94,8 +95,8 @@ public class TestJpaDstu3Config extends BaseJavaConfigDstu3 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu3"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaR4Config.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaR4Config.java index 1716e099cad..988cea91c3a 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaR4Config.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaR4Config.java @@ -41,6 +41,7 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Lazy; @@ -94,8 +95,8 @@ public class TestJpaR4Config extends BaseJavaConfigR4 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaR4"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java index e0485484db4..3ebafd453f3 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java @@ -23,6 +23,7 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.r5.utils.IResourceValidator; import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -134,8 +135,8 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu2"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java index a8d454a92e2..c9c6f3ae8b5 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java @@ -23,6 +23,7 @@ import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.r5.utils.IResourceValidator; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -140,8 +141,8 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu3"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java index e0db7abf4a9..1e7d96c49ca 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java @@ -24,6 +24,7 @@ import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.r5.utils.IResourceValidator; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -133,8 +134,8 @@ public class TestR4Config extends BaseJavaConfigR4 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaR4"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java index 5fc6e03cde4..4eca9abdf2c 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java @@ -23,6 +23,7 @@ import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.r5.utils.IResourceValidator; import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -133,8 +134,8 @@ public class TestR5Config extends BaseJavaConfigR5 { @Override @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); + public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { + LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(theConfigurableListableBeanFactory); retVal.setPersistenceUnitName("PU_HapiFhirJpaR5"); retVal.setDataSource(dataSource()); retVal.setJpaProperties(jpaProperties()); From ecd93c9e8a9ffb461953a26c07067fac983eae46 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 13:54:28 -0400 Subject: [PATCH 6/9] Add changelog --- .../fhir/changelog/5_6_0/2962-custom-elastic-prefixes.yaml | 5 +++++ .../HapiFhirLocalContainerEntityManagerFactoryBean.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2962-custom-elastic-prefixes.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2962-custom-elastic-prefixes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2962-custom-elastic-prefixes.yaml new file mode 100644 index 00000000000..111873ad87a --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2962-custom-elastic-prefixes.yaml @@ -0,0 +1,5 @@ +--- +type: fix +issue: 2962 +jira: SMILE-720 +title: "Added a new DaoConfig setting called `setElasticSearchIndexPrefix(String prefix)` which will cause Hibernate search to prefix all of its tables with the provided value." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java index e9140c55d66..5c6e44a0b02 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java @@ -36,7 +36,7 @@ import java.util.Map; */ public class HapiFhirLocalContainerEntityManagerFactoryBean extends LocalContainerEntityManagerFactoryBean { - //Weeeeee : https://stackoverflow.com/questions/57902388/how-to-inject-spring-beans-into-the-hibernate-envers-revisionlistener + //https://stackoverflow.com/questions/57902388/how-to-inject-spring-beans-into-the-hibernate-envers-revisionlistener ConfigurableListableBeanFactory myConfigurableListableBeanFactory; public HapiFhirLocalContainerEntityManagerFactoryBean(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) { @@ -75,7 +75,7 @@ public class HapiFhirLocalContainerEntityManagerFactoryBean extends LocalContain retVal.put(AvailableSettings.BATCH_VERSIONED_DATA, "true"); } //Why is this here, you ask? LocalContainerEntityManagerFactoryBean actually clobbers the setting hibernate needs - //in order to be able to resolve beans, so we add it back in manually here: + //in order to be able to resolve beans, so we add it back in manually here if (!retVal.containsKey(AvailableSettings.BEAN_CONTAINER)) { retVal.put(AvailableSettings.BEAN_CONTAINER, new SpringBeanContainer(myConfigurableListableBeanFactory)); } From 3ec47cb0bae5937dd76d398112c2d520cb13d49e Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 13:58:22 -0400 Subject: [PATCH 7/9] Bump version as we break the localcontainerentitymanagerfactory bean constructors args --- hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- hapi-fhir-bom/pom.xml | 4 ++-- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-docs/pom.xml | 2 +- hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-api/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-batch/pom.xml | 2 +- hapi-fhir-jpaserver-cql/pom.xml | 2 +- hapi-fhir-jpaserver-mdm/pom.xml | 2 +- hapi-fhir-jpaserver-migrate/pom.xml | 2 +- hapi-fhir-jpaserver-model/pom.xml | 2 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- hapi-fhir-server-mdm/pom.xml | 2 +- hapi-fhir-server-openapi/pom.xml | 2 +- hapi-fhir-server/pom.xml | 2 +- .../hapi-fhir-spring-boot-autoconfigure/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../hapi-fhir-spring-boot-samples/pom.xml | 2 +- .../hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-structures-r5/pom.xml | 2 +- hapi-fhir-test-utilities/pom.xml | 2 +- hapi-fhir-testpage-overlay/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2.1/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation-resources-r5/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 16 ++++++++-------- hapi-tinder-test/pom.xml | 2 +- pom.xml | 2 +- .../pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-client/pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-server/pom.xml | 2 +- 56 files changed, 64 insertions(+), 64 deletions(-) diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 266c65a230b..e7b4678dcaf 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index f6390a03ab5..5080a741de5 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 311fd519e79..cf2f5a9d5c8 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index 0ee5d85b77e..5b83473d8bd 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -3,14 +3,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index 05da3e3fee3..e75639496f0 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index acc6ac71323..da95c8249b7 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 2b8034bb414..39a65d2c304 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 86dc09e7364..918a356bcce 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index 7b1c2cabc2a..fc1ff968610 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 10ac2018c17..22095a8b31e 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index df4e808eaff..3edd8134ceb 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index bca1b836071..507cc110724 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 3d086916574..9203c8fa4d2 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 3001c607337..8a4adc9ac2a 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index ed82d9af335..9679ed049c5 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-api/pom.xml b/hapi-fhir-jpaserver-api/pom.xml index f763646e3f4..4da1a0f45ee 100644 --- a/hapi-fhir-jpaserver-api/pom.xml +++ b/hapi-fhir-jpaserver-api/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 8fb7260401d..de3950d1860 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-batch/pom.xml b/hapi-fhir-jpaserver-batch/pom.xml index 7d7c41e39ce..537dbf63a6d 100644 --- a/hapi-fhir-jpaserver-batch/pom.xml +++ b/hapi-fhir-jpaserver-batch/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml index 37991c7f946..d35fc53d840 100644 --- a/hapi-fhir-jpaserver-cql/pom.xml +++ b/hapi-fhir-jpaserver-cql/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index ecb9bee6d63..b107b05524d 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-migrate/pom.xml b/hapi-fhir-jpaserver-migrate/pom.xml index 583bb43b316..51ad10f5afd 100644 --- a/hapi-fhir-jpaserver-migrate/pom.xml +++ b/hapi-fhir-jpaserver-migrate/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 4c1f86a37fc..99858b3966c 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 85e78caf1ba..a3057b5f43b 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index e3609e6f624..ec5d4f3dbfb 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index c0fa455be9b..cd6c3fadfcc 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 9ef24cb24a2..b044e150afd 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index 8a7136ac721..6bce8a8a03a 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index ac3f9f6c8cc..fa6e5acf538 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index da732fe7ec6..df1d48956cb 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index 5a9a9c59259..806c163b4a0 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index 3094d404947..20d4de90f0b 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index 92f24d8e8b2..42703201b87 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 62d7edf17ed..da89e1a588e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index d98baa42dc8..eed71fc788b 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index b8e4c3aedce..c85465c39c1 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index fb7d126c0e1..3153f3339c5 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index d231b68390e..985c794b0b0 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index fb145734f63..bea02731f16 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index 4bedefad1aa..75e68f16c5b 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 6130d8e82ac..ce80fb38faa 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index 2c5394bf890..6c7ed34d4a1 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index f2eca4d974b..318e07cdd9d 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index d0f8df7fe7d..a542bb6ed6b 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index b38c453f4f7..6b85577acd9 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 0fe4837d110..51d1172c750 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 1fcaa23f8d6..b65d94a559c 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index 16a4b8587a3..c2c456377c7 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index ff9a3a78873..48f48396833 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index 9c17f5a0166..303087ec902 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index e4b063f26f2..f354d0d585d 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index b9efe893439..efd54036104 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml @@ -58,37 +58,37 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r5 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu3 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT org.apache.velocity diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 6db23c691f5..9395f743979 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 9f3e86e83f0..a4ce1a7c719 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index a8d1bc42c51..f095488f4f4 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 157a22a3da7..dbfadbe9543 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index be74e99f134..8b8aa95b196 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE3-SNAPSHOT + 5.6.0-PRE4-SNAPSHOT ../../pom.xml From c2414d2cae578bdddd5f69abab5a7c0dae4d8699 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 7 Sep 2021 18:35:59 -0400 Subject: [PATCH 8/9] Throw error if misconfigured --- .../search/elastic/IndexNamePrefixLayoutStrategy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java index 9f5f48f37af..fa5721b75dc 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.search.elastic; +import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.jpa.api.config.DaoConfig; import org.apache.commons.lang3.StringUtils; import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; @@ -40,7 +41,7 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { } private String addPrefixIfNecessary(String theCandidateName) { - + validateDaoConfigIsPresent(); if (!StringUtils.isBlank(myDaoConfig.getElasticSearchIndexPrefix())) { return myDaoConfig.getElasticSearchIndexPrefix() + "-" + theCandidateName; } else { @@ -63,10 +64,16 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { } private String removePrefixIfNecessary(String theCandidateUniqueKey) { + validateDaoConfigIsPresent(); if (!StringUtils.isBlank(myDaoConfig.getElasticSearchIndexPrefix())) { return theCandidateUniqueKey.replace(myDaoConfig.getElasticSearchIndexPrefix() + "-", ""); } else { return theCandidateUniqueKey; } } + private void validateDaoConfigIsPresent() { + if (myDaoConfig == null) { + throw new ConfigurationException("While attempting to boot HAPI FHIR, the Hibernate Search bootstrapper failed to find the DaoConfig. This probably means Hibernate Search has been recently upgraded, or somebody modified HapiFhirLocalContainerEntityManagerFactoryBean."); + } + } } From 5d5c45e3574f3416edd0d0ef3f58f2e3cda9967d Mon Sep 17 00:00:00 2001 From: Tadgh Date: Wed, 8 Sep 2021 08:49:19 -0400 Subject: [PATCH 9/9] Add whitespace --- .../HapiFhirLocalContainerEntityManagerFactoryBean.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java index 5c6e44a0b02..c0e3fcc1cf6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirLocalContainerEntityManagerFactoryBean.java @@ -74,8 +74,8 @@ public class HapiFhirLocalContainerEntityManagerFactoryBean extends LocalContain if (!retVal.containsKey(AvailableSettings.BATCH_VERSIONED_DATA)) { retVal.put(AvailableSettings.BATCH_VERSIONED_DATA, "true"); } - //Why is this here, you ask? LocalContainerEntityManagerFactoryBean actually clobbers the setting hibernate needs - //in order to be able to resolve beans, so we add it back in manually here + // Why is this here, you ask? LocalContainerEntityManagerFactoryBean actually clobbers the setting hibernate needs + // in order to be able to resolve beans, so we add it back in manually here if (!retVal.containsKey(AvailableSettings.BEAN_CONTAINER)) { retVal.put(AvailableSettings.BEAN_CONTAINER, new SpringBeanContainer(myConfigurableListableBeanFactory)); }