Merge remote-tracking branch 'origin/jpa_dep_cleanup'

This commit is contained in:
James Agnew 2016-09-30 14:04:24 -04:00
commit 22c2d301dc
5 changed files with 85 additions and 57 deletions

View File

@ -50,10 +50,6 @@ import ca.uhn.fhir.jpa.term.IHapiTerminologySvc;
@EnableJpaRepositories(basePackages = "ca.uhn.fhir.jpa.dao.data")
public class BaseConfig implements SchedulingConfigurer {
private static FhirContext ourFhirContextDstu1;
private static FhirContext ourFhirContextDstu2;
private static FhirContext ourFhirContextDstu2Hl7Org;
private static FhirContext ourFhirContextDstu3;
@Resource
private ApplicationContext myAppCtx;
@ -71,45 +67,7 @@ public class BaseConfig implements SchedulingConfigurer {
return new DatabaseBackedPagingProvider(10);
}
@Bean(name = "myFhirContextDstu1")
@Lazy
public FhirContext fhirContextDstu1() {
if (ourFhirContextDstu1 == null) {
ourFhirContextDstu1 = FhirContext.forDstu1();
}
return ourFhirContextDstu1;
}
@Bean(name = "myFhirContextDstu2")
@Lazy
public FhirContext fhirContextDstu2() {
if (ourFhirContextDstu2 == null) {
ourFhirContextDstu2 = FhirContext.forDstu2();
}
return ourFhirContextDstu2;
}
@Bean(name = "myFhirContextDstu2Hl7Org")
@Lazy
public FhirContext fhirContextDstu2Hl7Org() {
if (ourFhirContextDstu2Hl7Org == null) {
ourFhirContextDstu2Hl7Org = FhirContext.forDstu2Hl7Org();
}
return ourFhirContextDstu2Hl7Org;
}
@Bean(name = "myFhirContextDstu3")
@Lazy
public FhirContext fhirContextDstu3() {
if (ourFhirContextDstu3 == null) {
ourFhirContextDstu3 = FhirContext.forDstu3();
// Don't strip versions in some places
ParserOptions parserOptions = ourFhirContextDstu3.getParserOptions();
parserOptions.setDontStripVersionsFromReferencesAtPaths("AuditEvent.entity.reference");
}
return ourFhirContextDstu3;
}
@Bean(autowire=Autowire.BY_TYPE)
public StaleSearchDeletingSvc staleSearchDeletingSvc() {

View File

@ -25,6 +25,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import ca.uhn.fhir.context.FhirContext;
@ -36,12 +37,22 @@ import ca.uhn.fhir.model.dstu2.composite.MetaDt;
@Configuration
public class BaseDstu1Config extends BaseConfig {
private static FhirContext ourFhirContextDstu1;
@Bean(autowire = Autowire.BY_TYPE)
public IHapiTerminologySvc terminologyService() {
return new HapiTerminologySvcDstu1();
}
@Bean(name = "myFhirContextDstu1")
@Lazy
public FhirContext fhirContextDstu1() {
if (ourFhirContextDstu1 == null) {
ourFhirContextDstu1 = FhirContext.forDstu1();
}
return ourFhirContextDstu1;
}
@Bean
@Primary

View File

@ -10,7 +10,7 @@ package ca.uhn.fhir.jpa.config;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.config;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@ -39,11 +40,8 @@ import ca.uhn.fhir.model.dstu2.composite.MetaDt;
@EnableTransactionManagement
public class BaseDstu2Config extends BaseConfig {
@Bean(autowire = Autowire.BY_TYPE)
public IHapiTerminologySvc terminologyService() {
return new HapiTerminologySvcDstu2();
}
private static FhirContext ourFhirContextDstu2;
private static FhirContext ourFhirContextDstu2Hl7Org;
@Bean
@Primary
@ -51,6 +49,24 @@ public class BaseDstu2Config extends BaseConfig {
return fhirContextDstu2();
}
@Bean(name = "myFhirContextDstu2")
@Lazy
public FhirContext fhirContextDstu2() {
if (ourFhirContextDstu2 == null) {
ourFhirContextDstu2 = FhirContext.forDstu2();
}
return ourFhirContextDstu2;
}
@Bean(name = "myFhirContextDstu2Hl7Org")
@Lazy
public FhirContext fhirContextDstu2Hl7Org() {
if (ourFhirContextDstu2Hl7Org == null) {
ourFhirContextDstu2Hl7Org = FhirContext.forDstu2Hl7Org();
}
return ourFhirContextDstu2Hl7Org;
}
@Bean(name = "myJpaValidationSupportDstu2", autowire = Autowire.BY_NAME)
public ca.uhn.fhir.jpa.dao.IJpaValidationSupportDstu2 jpaValidationSupportDstu2() {
ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2 retVal = new ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2();
@ -63,6 +79,11 @@ public class BaseDstu2Config extends BaseConfig {
return searchDao;
}
@Bean(autowire = Autowire.BY_TYPE)
public SearchParamExtractorDstu2 searchParamExtractor() {
return new SearchParamExtractorDstu2();
}
@Bean(name = "mySystemDaoDstu2", autowire = Autowire.BY_NAME)
public IFhirSystemDao<ca.uhn.fhir.model.dstu2.resource.Bundle, MetaDt> systemDaoDstu2() {
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2();
@ -75,10 +96,10 @@ public class BaseDstu2Config extends BaseConfig {
retVal.setDao(systemDaoDstu2());
return retVal;
}
@Bean(autowire=Autowire.BY_TYPE)
public SearchParamExtractorDstu2 searchParamExtractor() {
return new SearchParamExtractorDstu2();
@Bean(autowire = Autowire.BY_TYPE)
public IHapiTerminologySvc terminologyService() {
return new HapiTerminologySvcDstu2();
}
}

View File

@ -32,6 +32,7 @@ import org.springframework.context.annotation.Primary;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.ParserOptions;
import ca.uhn.fhir.jpa.config.BaseConfig;
import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
@ -61,8 +62,14 @@ public class BaseDstu3Config extends BaseConfig {
@Bean
@Primary
public FhirContext defaultFhirContext() {
return fhirContextDstu3();
public FhirContext fhirContextDstu3() {
FhirContext retVal = FhirContext.forDstu3();
// Don't strip versions in some places
ParserOptions parserOptions = retVal.getParserOptions();
parserOptions.setDontStripVersionsFromReferencesAtPaths("AuditEvent.entity.reference");
return retVal;
}
@Bean(name = "myInstanceValidatorDstu3")
@ -95,7 +102,7 @@ public class BaseDstu3Config extends BaseConfig {
@Bean(name = "mySystemProviderDstu3")
public ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3 systemProviderDstu3() {
ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3 retVal = new ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3();
retVal.setContext(defaultFhirContext());
retVal.setContext(fhirContextDstu3());
retVal.setDao(systemDaoDstu3());
return retVal;
}
@ -114,7 +121,7 @@ public class BaseDstu3Config extends BaseConfig {
@Bean(autowire=Autowire.BY_TYPE)
public TerminologyUploaderProviderDstu3 terminologyUploaderProvider() {
TerminologyUploaderProviderDstu3 retVal = new TerminologyUploaderProviderDstu3();
retVal.setContext(defaultFhirContext());
retVal.setContext(fhirContextDstu3());
return retVal;
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hapi-fhir-narrativegenerator</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>