mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-25 01:18:37 +00:00
Merge remote-tracking branch 'remotes/origin/master' into ks-flyway
This commit is contained in:
commit
4c732ce977
@ -44,6 +44,7 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -51,6 +52,7 @@ import java.util.Set;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
@Transactional
|
||||
public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao<CodeSystem> implements IFhirResourceDaoCodeSystem<CodeSystem, Coding, CodeableConcept> {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoCodeSystemDstu3.class);
|
||||
@ -62,6 +64,10 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao<Code
|
||||
@Autowired
|
||||
protected ITermCodeSystemStorageSvc myTerminologyCodeSystemStorageSvc;
|
||||
|
||||
public FhirResourceDaoCodeSystemDstu3() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem, RequestDetails theRequest) {
|
||||
Set<Long> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest );
|
||||
|
@ -50,6 +50,48 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||
myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testBundleComposition() {
|
||||
SearchParameter fooSp = new SearchParameter();
|
||||
fooSp.setCode("foo");
|
||||
fooSp.addBase("Bundle");
|
||||
fooSp.setType(Enumerations.SearchParamType.REFERENCE);
|
||||
fooSp.setTitle("FOO SP");
|
||||
fooSp.setExpression("Bundle.entry[0].resource.as(Composition).encounter");
|
||||
fooSp.setXpathUsage(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL);
|
||||
fooSp.setStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
|
||||
|
||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(fooSp));
|
||||
|
||||
mySearchParameterDao.create(fooSp, mySrd);
|
||||
mySearchParamRegistry.forceRefresh();
|
||||
|
||||
Encounter enc = new Encounter();
|
||||
enc.setStatus(Encounter.EncounterStatus.ARRIVED);
|
||||
String encId = myEncounterDao.create(enc).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
Composition composition = new Composition();
|
||||
composition.getEncounter().setReference(encId);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.setType(Bundle.BundleType.DOCUMENT);
|
||||
bundle.addEntry().setResource(composition);
|
||||
|
||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
|
||||
String bundleId = myBundleDao.create(bundle).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
SearchParameterMap map;
|
||||
|
||||
map = new SearchParameterMap();
|
||||
map.setLoadSynchronous(true);
|
||||
map.add("foo", new ReferenceParam(encId));
|
||||
IBundleProvider results = myBundleDao.search(map);
|
||||
assertThat(toUnqualifiedVersionlessIdValues(results), hasItems(bundleId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreateInvalidNoBase() {
|
||||
SearchParameter fooSp = new SearchParameter();
|
||||
|
@ -61,6 +61,14 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
||||
protected void init410() { // 20190815 - present
|
||||
Builder version = forVersion(VersionEnum.V4_1_0);
|
||||
|
||||
version.onTable("HFJ_SPIDX_NUMBER").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_COORDS").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_TOKEN").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_STRING").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_DATE").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_QUANTITY").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
version.onTable("HFJ_SPIDX_URI").modifyColumn("RES_ID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG);
|
||||
|
||||
// HFJ_SEARCH
|
||||
version.onTable("HFJ_SEARCH").addColumn("20190921.1", "EXPIRY_OR_NULL").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP);
|
||||
version.onTable("HFJ_SEARCH").addColumn("20190921.2", "NUM_BLOCKED").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT);
|
||||
|
@ -70,13 +70,6 @@ public class ResourceLinkExtractor {
|
||||
public void extractResourceLinks(ResourceIndexedSearchParams theParams, ResourceTable theEntity, IBaseResource theResource, Date theUpdateTime, IResourceLinkResolver theResourceLinkResolver, boolean theFailOnInvalidReference, RequestDetails theRequest) {
|
||||
String resourceType = theEntity.getResourceType();
|
||||
|
||||
/*
|
||||
* For now we don't try to load any of the links in a bundle if it's the actual bundle we're storing..
|
||||
*/
|
||||
if (theResource instanceof IBaseBundle) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, RuntimeSearchParam> searchParams = mySearchParamRegistry.getActiveSearchParams(toResourceName(theResource.getClass()));
|
||||
|
||||
for (RuntimeSearchParam nextSpDef : searchParams.values()) {
|
||||
|
@ -31,9 +31,8 @@ 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.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -52,13 +51,12 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
|
||||
@VisibleForTesting
|
||||
public SearchParamExtractorDstu3(ModelConfig theModelConfig, FhirContext theCtx, IValidationSupport theValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
|
||||
super(theCtx, theSearchParamRegistry);
|
||||
start(null);
|
||||
initFhirPathEngine(theValidationSupport);
|
||||
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);
|
||||
@ -71,16 +69,19 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@EventListener
|
||||
public void start(ContextRefreshedEvent theEvent) {
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void start() {
|
||||
super.start();
|
||||
if (myFhirPathEngine == null) {
|
||||
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
initFhirPathEngine(support);
|
||||
}
|
||||
}
|
||||
|
||||
public void initFhirPathEngine(IValidationSupport theSupport) {
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), theSupport);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
|
||||
@VisibleForTesting
|
||||
public SearchParamExtractorR4(ModelConfig theModelConfig, FhirContext theCtx, IValidationSupport theValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
|
||||
super(theCtx, theSearchParamRegistry);
|
||||
initFhirPath();
|
||||
initFhirPath(theValidationSupport);
|
||||
start();
|
||||
}
|
||||
|
||||
@ -71,16 +71,22 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void initFhirPath() {
|
||||
public void start() {
|
||||
super.start();
|
||||
if (myFhirPathEngine == null) {
|
||||
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
myFhirPathEngine.setHostServices(new SearchParamExtractorR4HostServices());
|
||||
initFhirPath(support);
|
||||
}
|
||||
}
|
||||
|
||||
public void initFhirPath(IValidationSupport theSupport) {
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), theSupport);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
myFhirPathEngine.setHostServices(new SearchParamExtractorR4HostServices());
|
||||
}
|
||||
|
||||
|
||||
private static class SearchParamExtractorR4HostServices implements FHIRPathEngine.IEvaluationContext {
|
||||
|
||||
|
@ -43,8 +43,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
public class SearchParamExtractorR5 extends BaseSearchParamExtractor implements ISearchParamExtractor {
|
||||
|
||||
@Autowired
|
||||
private IValidationSupport myValidationSupport;
|
||||
private FHIRPathEngine myFhirPathEngine;
|
||||
|
||||
public SearchParamExtractorR5() {
|
||||
@ -56,21 +54,26 @@ public class SearchParamExtractorR5 extends BaseSearchParamExtractor implements
|
||||
*/
|
||||
public SearchParamExtractorR5(FhirContext theCtx, DefaultProfileValidationSupport theDefaultProfileValidationSupport, ISearchParamRegistry theSearchParamRegistry) {
|
||||
super(theCtx, theSearchParamRegistry);
|
||||
myValidationSupport = theDefaultProfileValidationSupport;
|
||||
initFhirPath();
|
||||
initFhirPath(theDefaultProfileValidationSupport);
|
||||
start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void initFhirPath() {
|
||||
public void start() {
|
||||
super.start();
|
||||
if (myFhirPathEngine == null) {
|
||||
IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class);
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), support);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
myFhirPathEngine.setHostServices(new SearchParamExtractorR5HostServices());
|
||||
initFhirPath(support);
|
||||
}
|
||||
}
|
||||
|
||||
public void initFhirPath(IValidationSupport theSupport) {
|
||||
IWorkerContext worker = new HapiWorkerContext(getContext(), theSupport);
|
||||
myFhirPathEngine = new FHIRPathEngine(worker);
|
||||
myFhirPathEngine.setHostServices(new SearchParamExtractorR5HostServices());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IValueExtractor getPathValueExtractor(IBaseResource theResource, String nextPath) {
|
||||
return () -> myFhirPathEngine.evaluate((Base) theResource, nextPath);
|
||||
|
2
pom.xml
2
pom.xml
@ -636,7 +636,7 @@
|
||||
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
||||
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
||||
<slf4j_version>1.7.28</slf4j_version>
|
||||
<spring_version>5.2.0.RELEASE</spring_version>
|
||||
<spring_version>5.2.1.RELEASE</spring_version>
|
||||
<!-- FYI: Spring Data JPA 2.1.9 causes test failures due to unexpected cascading deletes -->
|
||||
<spring_data_version>2.2.0.RELEASE</spring_data_version>
|
||||
<spring_boot_version>2.2.0.RELEASE</spring_boot_version>
|
||||
|
Loading…
x
Reference in New Issue
Block a user