From 7a44868c5f5544a5a30d838b0bdead182bfee391 Mon Sep 17 00:00:00 2001 From: Jonathan Percival Date: Wed, 15 Sep 2021 12:15:47 -0600 Subject: [PATCH] Fix shared db, fix spring getting confused --- .../org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java | 2 +- .../org/opencds/cqf/dstu3/evaluation/ProviderFactory.java | 5 ++++- .../cqf/dstu3/providers/ActivityDefinitionApplyProvider.java | 3 ++- .../cqf/dstu3/providers/PlanDefinitionApplyProvider.java | 3 ++- .../java/org/opencds/cqf/dstu3/servlet/CdsHooksServlet.java | 2 +- dstu3/src/main/resources/hapi.properties | 4 ++-- .../java/org/opencds/cqf/r4/config/FhirServerConfigR4.java | 2 +- .../java/org/opencds/cqf/r4/evaluation/ProviderFactory.java | 5 ++++- .../cqf/r4/providers/ActivityDefinitionApplyProvider.java | 3 ++- .../cqf/r4/providers/PlanDefinitionApplyProvider.java | 3 ++- .../java/org/opencds/cqf/r4/servlet/CdsHooksServlet.java | 2 +- r4/src/main/resources/hapi.properties | 4 ++-- 12 files changed, 24 insertions(+), 14 deletions(-) diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java index 39a360697..736a78f78 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java @@ -138,7 +138,7 @@ public TerminologyProvider terminologyProvider(Map> termi return new CacheAwareTerminologyProvider(terminologyCache, jpaTerminologyProvider); } - @Bean + @Bean(name = "dstu3ModelResolver") public ModelResolver modelResolver() { return new CachingModelResolverDecorator(new Dstu3FhirModelResolver()); } diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/ProviderFactory.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/ProviderFactory.java index 206dfb1af..dac30ded0 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/ProviderFactory.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/ProviderFactory.java @@ -1,7 +1,9 @@ package org.opencds.cqf.dstu3.evaluation; import javax.inject.Inject; +import javax.inject.Named; +import org.apache.lucene.search.BooleanQuery; import org.opencds.cqf.common.evaluation.EvaluationProviderFactory; import org.opencds.cqf.common.helpers.ClientHelper; import org.opencds.cqf.common.providers.Dstu3ApelonFhirTerminologyProvider; @@ -34,7 +36,8 @@ public class ProviderFactory implements EvaluationProviderFactory { @Inject public ProviderFactory(FhirContext fhirContext, DaoRegistry registry, - TerminologyProvider defaultTerminologyProvider, ModelResolver modelResolver) { + TerminologyProvider defaultTerminologyProvider, @Named("dstu3ModelResolver") ModelResolver modelResolver) { + BooleanQuery.setMaxClauseCount(10000000); this.defaultTerminologyProvider = defaultTerminologyProvider; this.registry = registry; this.fhirContext = fhirContext; diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/ActivityDefinitionApplyProvider.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/ActivityDefinitionApplyProvider.java index 6d1b30b15..3f0da4041 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/ActivityDefinitionApplyProvider.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/ActivityDefinitionApplyProvider.java @@ -6,6 +6,7 @@ import java.util.List; import javax.inject.Inject; +import javax.inject.Named; import org.hl7.fhir.dstu3.model.ActivityDefinition; import org.hl7.fhir.dstu3.model.Attachment; @@ -47,7 +48,7 @@ public class ActivityDefinitionApplyProvider { @Inject public ActivityDefinitionApplyProvider(FhirContext fhirContext, CqlExecutionProvider executionProvider, - IFhirResourceDao activityDefinitionDao, ModelResolver modelResolver) { + IFhirResourceDao activityDefinitionDao, @Named("dstu3ModelResolver") ModelResolver modelResolver) { this.modelResolver = modelResolver; this.executionProvider = executionProvider; this.activityDefinitionDao = activityDefinitionDao; diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/PlanDefinitionApplyProvider.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/PlanDefinitionApplyProvider.java index 2aa9e0392..ac262403b 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/PlanDefinitionApplyProvider.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/providers/PlanDefinitionApplyProvider.java @@ -7,6 +7,7 @@ import java.util.UUID; import javax.inject.Inject; +import javax.inject.Named; import org.hl7.fhir.dstu3.model.ActivityDefinition; import org.hl7.fhir.dstu3.model.CarePlan; @@ -64,7 +65,7 @@ public class PlanDefinitionApplyProvider { public PlanDefinitionApplyProvider(FhirContext fhirContext, ActivityDefinitionApplyProvider activityDefinitionApplyProvider, IFhirResourceDao planDefinitionDao, - IFhirResourceDao activityDefinitionDao, CqlExecutionProvider executionProvider, ModelResolver modelResolver) { + IFhirResourceDao activityDefinitionDao, CqlExecutionProvider executionProvider, @Named("dstu3ModelResolver") ModelResolver modelResolver) { this.executionProvider = executionProvider; this.modelResolver = modelResolver; this.activityDefinitionApplyProvider = activityDefinitionApplyProvider; diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/servlet/CdsHooksServlet.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/servlet/CdsHooksServlet.java index 0a7395d6a..628cd471a 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/servlet/CdsHooksServlet.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/servlet/CdsHooksServlet.java @@ -90,7 +90,7 @@ public void init() { this.libraryResolutionProvider = (LibraryResolutionProvider)appCtx.getBean(LibraryResolutionProvider.class); this.fhirRetrieveProvider = appCtx.getBean(JpaFhirRetrieveProvider.class); this.serverTerminologyProvider = appCtx.getBean(TerminologyProvider.class); - this.modelResolver = appCtx.getBean(ModelResolver.class); + this.modelResolver = appCtx.getBean("dstu3ModelResolver", ModelResolver.class); this.libraryHelper = appCtx.getBean(LibraryHelper.class); } diff --git a/dstu3/src/main/resources/hapi.properties b/dstu3/src/main/resources/hapi.properties index 07284affb..fd912e1b6 100644 --- a/dstu3/src/main/resources/hapi.properties +++ b/dstu3/src/main/resources/hapi.properties @@ -78,7 +78,7 @@ fhirpath_interceptor.enabled=false datasource.driver=org.apache.derby.jdbc.EmbeddedDriver -datasource.url=jdbc:derby:target/derby;create=true +datasource.url=jdbc:derby:target/derbyDstu3;create=true hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect spring.jpa.hibernate.ddl-auto=update datasource.username= @@ -95,7 +95,7 @@ hibernate.search.enabled=true hibernate.search.backend.type=lucene hibernate.search.backend.analysis.configurer=ca.uhn.fhir.jpa.search.HapiLuceneAnalysisConfigurer hibernate.search.backend.directory.type=local-filesystem -hibernate.search.backend.directory.root=target/lucenefiles +hibernate.search.backend.directory.root=target/lucenefilesDstu3 hibernate.search.backend.lucene_version=lucene_current # hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory # hibernate.search.default.directory_provider=filesystem diff --git a/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java b/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java index 255d379d4..bcd7510e1 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java +++ b/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java @@ -140,7 +140,7 @@ public TerminologyProvider terminologyProvider(Map> termi return new CacheAwareTerminologyProvider(terminologyCache, jpaTerminologyProvider); } - @Bean + @Bean(name = "r4ModelResolver") public ModelResolver modelResolver() { return new CachingModelResolverDecorator(new R4FhirModelResolver()); } diff --git a/r4/src/main/java/org/opencds/cqf/r4/evaluation/ProviderFactory.java b/r4/src/main/java/org/opencds/cqf/r4/evaluation/ProviderFactory.java index a9499d17e..c54c3916c 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/evaluation/ProviderFactory.java +++ b/r4/src/main/java/org/opencds/cqf/r4/evaluation/ProviderFactory.java @@ -1,7 +1,9 @@ package org.opencds.cqf.r4.evaluation; import javax.inject.Inject; +import javax.inject.Named; +import org.apache.lucene.search.BooleanQuery; import org.opencds.cqf.common.evaluation.EvaluationProviderFactory; import org.opencds.cqf.common.helpers.ClientHelper; import org.opencds.cqf.common.providers.R4ApelonFhirTerminologyProvider; @@ -31,7 +33,8 @@ public class ProviderFactory implements EvaluationProviderFactory { @Inject public ProviderFactory(FhirContext fhirContext, DaoRegistry registry, - TerminologyProvider defaultTerminologyProvider, ModelResolver modelResolver) { + TerminologyProvider defaultTerminologyProvider, @Named("r4ModelResolver") ModelResolver modelResolver) { + BooleanQuery.setMaxClauseCount(10000000); this.defaultTerminologyProvider = defaultTerminologyProvider; this.registry = registry; this.fhirContext = fhirContext; diff --git a/r4/src/main/java/org/opencds/cqf/r4/providers/ActivityDefinitionApplyProvider.java b/r4/src/main/java/org/opencds/cqf/r4/providers/ActivityDefinitionApplyProvider.java index bbeb39d78..cb9ab0f29 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/providers/ActivityDefinitionApplyProvider.java +++ b/r4/src/main/java/org/opencds/cqf/r4/providers/ActivityDefinitionApplyProvider.java @@ -6,6 +6,7 @@ import java.util.List; import javax.inject.Inject; +import javax.inject.Named; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.ActivityDefinition; @@ -56,7 +57,7 @@ public class ActivityDefinitionApplyProvider { @Inject public ActivityDefinitionApplyProvider(FhirContext fhirContext, CqlExecutionProvider executionProvider, - IFhirResourceDao activityDefinitionDao, ModelResolver modelResolver) { + IFhirResourceDao activityDefinitionDao, @Named("r4ModelResolver") ModelResolver modelResolver) { this.modelResolver = modelResolver; this.executionProvider = executionProvider; this.activityDefinitionDao = activityDefinitionDao; diff --git a/r4/src/main/java/org/opencds/cqf/r4/providers/PlanDefinitionApplyProvider.java b/r4/src/main/java/org/opencds/cqf/r4/providers/PlanDefinitionApplyProvider.java index 3881f4e35..617aac721 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/providers/PlanDefinitionApplyProvider.java +++ b/r4/src/main/java/org/opencds/cqf/r4/providers/PlanDefinitionApplyProvider.java @@ -7,6 +7,7 @@ import java.util.UUID; import javax.inject.Inject; +import javax.inject.Named; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.ActivityDefinition; @@ -66,7 +67,7 @@ public class PlanDefinitionApplyProvider { public PlanDefinitionApplyProvider(FhirContext fhirContext, ActivityDefinitionApplyProvider activityDefinitionApplyProvider, IFhirResourceDao planDefinitionDao, - IFhirResourceDao activityDefinitionDao, CqlExecutionProvider executionProvider, ModelResolver modelResolver) { + IFhirResourceDao activityDefinitionDao, CqlExecutionProvider executionProvider, @Named("r4ModelResolver") ModelResolver modelResolver) { this.executionProvider = executionProvider; this.modelResolver = modelResolver; this.activityDefinitionApplyProvider = activityDefinitionApplyProvider; diff --git a/r4/src/main/java/org/opencds/cqf/r4/servlet/CdsHooksServlet.java b/r4/src/main/java/org/opencds/cqf/r4/servlet/CdsHooksServlet.java index 9856bbbe0..8f0bd4143 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/servlet/CdsHooksServlet.java +++ b/r4/src/main/java/org/opencds/cqf/r4/servlet/CdsHooksServlet.java @@ -90,7 +90,7 @@ public void init() { this.libraryResolutionProvider = (LibraryResolutionProvider)appCtx.getBean(LibraryResolutionProvider.class); this.fhirRetrieveProvider = appCtx.getBean(JpaFhirRetrieveProvider.class); this.serverTerminologyProvider = appCtx.getBean(TerminologyProvider.class); - this.modelResolver = appCtx.getBean(ModelResolver.class); + this.modelResolver = appCtx.getBean("r4ModelResolver", ModelResolver.class); this.libraryHelper = appCtx.getBean(LibraryHelper.class); } diff --git a/r4/src/main/resources/hapi.properties b/r4/src/main/resources/hapi.properties index 75613da2e..9deee11b4 100644 --- a/r4/src/main/resources/hapi.properties +++ b/r4/src/main/resources/hapi.properties @@ -78,7 +78,7 @@ fhirpath_interceptor.enabled=false datasource.driver=org.apache.derby.jdbc.EmbeddedDriver -datasource.url=jdbc:derby:target/derby;create=true +datasource.url=jdbc:derby:target/derbyR4;create=true hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect spring.jpa.hibernate.ddl-auto=update datasource.username= @@ -96,7 +96,7 @@ hibernate.search.enabled=true hibernate.search.backend.type=lucene hibernate.search.backend.analysis.configurer=ca.uhn.fhir.jpa.search.HapiLuceneAnalysisConfigurer hibernate.search.backend.directory.type=local-filesystem -hibernate.search.backend.directory.root=target/lucenefiles +hibernate.search.backend.directory.root=target/lucenefilesR4 hibernate.search.backend.lucene_version=lucene_current # hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory # hibernate.search.default.directory_provider=filesystem