Merge remote-tracking branch 'remotes/origin/master' into ks-flyway

This commit is contained in:
Ken Stevens 2019-11-03 13:46:51 -05:00
commit 6ff1aaae61
4 changed files with 29 additions and 27 deletions

View File

@ -31,21 +31,14 @@ import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.utils.FHIRPathEngine;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import java.util.ArrayList;
import java.util.List;
import static org.apache.commons.lang3.StringUtils.trim;
public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implements ISearchParamExtractor {
@Autowired
private org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport myValidationSupport;
private HapiWorkerContext myWorkerContext;
private FHIRPathEngine myFhirPathEngine;
/**
@ -59,13 +52,13 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
@VisibleForTesting
public SearchParamExtractorDstu3(ModelConfig theModelConfig, FhirContext theCtx, IValidationSupport theValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
super(theCtx, theSearchParamRegistry);
myValidationSupport = theValidationSupport;
start(null);
start();
}
@Override
protected IValueExtractor getPathValueExtractor(IBaseResource theResource, String theSinglePath) {
start(null);
return () -> {
List<IBase> values = new ArrayList<>();
List<Base> allValues = myFhirPathEngine.evaluate((Base) theResource, theSinglePath);
@ -77,13 +70,17 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
};
}
@EventListener
public void start(ContextRefreshedEvent theEvent) {
if (myValidationSupport == null) {
myValidationSupport = myApplicationContext.getBean(IValidationSupport.class);
}
IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport);
if (myFhirPathEngine == null) {
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
myFhirPathEngine = new FHIRPathEngine(worker);
}
}
}

View File

@ -41,7 +41,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements ISearchParamExtractor {
private IValidationSupport myValidationSupport;
private FHIRPathEngine myFhirPathEngine;
/**
@ -55,7 +54,6 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
@VisibleForTesting
public SearchParamExtractorR4(ModelConfig theModelConfig, FhirContext theCtx, IValidationSupport theValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
super(theCtx, theSearchParamRegistry);
myValidationSupport = theValidationSupport;
initFhirPath();
start();
}
@ -68,15 +66,20 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
};
}
@PostConstruct
public void initFhirPath() {
if (myValidationSupport == null) {
myValidationSupport = myApplicationContext.getBean(IValidationSupport.class);
}
IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport);
if (myFhirPathEngine == null) {
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
myFhirPathEngine = new FHIRPathEngine(worker);
myFhirPathEngine.setHostServices(new SearchParamExtractorR4HostServices());
}
}
private static class SearchParamExtractorR4HostServices implements FHIRPathEngine.IEvaluationContext {

View File

@ -26,8 +26,8 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r5.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r5.hapi.ctx.IValidationSupport;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
@ -57,17 +57,19 @@ public class SearchParamExtractorR5 extends BaseSearchParamExtractor implements
public SearchParamExtractorR5(FhirContext theCtx, DefaultProfileValidationSupport theDefaultProfileValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
super(theCtx, theSearchParamRegistry);
myValidationSupport = theDefaultProfileValidationSupport;
initFhirPath();
start();
}
@Override
@PostConstruct
public void start() {
super.start();
IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport);
public void initFhirPath() {
if (myFhirPathEngine == null) {
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
myFhirPathEngine = new FHIRPathEngine(worker);
myFhirPathEngine.setHostServices(new SearchParamExtractorR5HostServices());
}
}
@Override
protected IValueExtractor getPathValueExtractor(IBaseResource theResource, String nextPath) {

View File

@ -746,7 +746,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<version>1.4.200</version>
</dependency>
<dependency>
<groupId>com.helger</groupId>