Updating HAPI to use latest core lib changes.
This commit is contained in:
parent
e92fd47b16
commit
367b338d85
|
@ -26,6 +26,7 @@ import org.apache.commons.cli.Options;
|
|||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVPrinter;
|
||||
import org.apache.commons.csv.QuoteMode;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.ConceptMap;
|
||||
|
@ -42,7 +43,6 @@ import java.util.List;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap;
|
||||
|
||||
public class ExportConceptMapToCsvCommand extends AbstractImportExportCsvConceptMapCommand {
|
||||
// TODO: Don't use qualified names for loggers in HAPI CLI.
|
||||
|
@ -110,7 +110,7 @@ public class ExportConceptMapToCsvCommand extends AbstractImportExportCsvConcept
|
|||
|
||||
private void convertConceptMapToCsv(org.hl7.fhir.dstu3.model.ConceptMap theConceptMap) throws ExecutionException {
|
||||
try {
|
||||
convertConceptMapToCsv(convertConceptMap(theConceptMap));
|
||||
convertConceptMapToCsv((ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap));
|
||||
} catch (FHIRException fe) {
|
||||
throw new ExecutionException(fe);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.commons.cli.Options;
|
|||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVParser;
|
||||
import org.apache.commons.csv.CSVRecord;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.ConceptMap;
|
||||
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
|
||||
|
@ -47,7 +48,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap;
|
||||
|
||||
public class ImportCsvToConceptMapCommand extends AbstractImportExportCsvConceptMapCommand {
|
||||
// TODO: Don't use qualified names for loggers in HAPI CLI.
|
||||
|
@ -152,7 +152,7 @@ public class ImportCsvToConceptMapCommand extends AbstractImportExportCsvConcept
|
|||
|
||||
private org.hl7.fhir.dstu3.model.ConceptMap convertCsvToConceptMapDstu3() throws ExecutionException {
|
||||
try {
|
||||
return convertConceptMap(convertCsvToConceptMapR4());
|
||||
return (org.hl7.fhir.dstu3.model.ConceptMap) VersionConvertorFactory_30_40.convertResource(convertCsvToConceptMapR4());
|
||||
} catch (FHIRException fe) {
|
||||
throw new ExecutionException(fe);
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@ import ca.uhn.fhir.rest.api.server.ResponseDetails;
|
|||
import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.interceptor.InterceptorAdapter;
|
||||
import org.hl7.fhir.converter.NullVersionConverterAdvisor30;
|
||||
import org.hl7.fhir.converter.NullVersionConverterAdvisor40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.converter.NullVersionConverterAdvisor10_30;
|
||||
import org.hl7.fhir.converter.NullVersionConverterAdvisor10_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -42,9 +42,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
/**
|
||||
* <b>This is an experimental interceptor! Use with caution as
|
||||
|
@ -58,12 +56,12 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
public class VersionedApiConverterInterceptor extends InterceptorAdapter {
|
||||
private final FhirContext myCtxDstu2;
|
||||
private final FhirContext myCtxDstu2Hl7Org;
|
||||
private final NullVersionConverterAdvisor40 advisor40;
|
||||
private final NullVersionConverterAdvisor30 advisor30;
|
||||
private final NullVersionConverterAdvisor10_40 advisor40;
|
||||
private final NullVersionConverterAdvisor10_30 advisor30;
|
||||
|
||||
public VersionedApiConverterInterceptor() {
|
||||
advisor40 = new NullVersionConverterAdvisor40();
|
||||
advisor30 = new NullVersionConverterAdvisor30();
|
||||
advisor40 = new NullVersionConverterAdvisor10_40();
|
||||
advisor30 = new NullVersionConverterAdvisor10_30();
|
||||
|
||||
myCtxDstu2 = FhirContext.forDstu2();
|
||||
myCtxDstu2Hl7Org = FhirContext.forDstu2Hl7Org();
|
||||
|
@ -104,17 +102,17 @@ public class VersionedApiConverterInterceptor extends InterceptorAdapter {
|
|||
IBaseResource converted = null;
|
||||
try {
|
||||
if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU3) {
|
||||
converted = VersionConvertor_30_40.convertResource(toDstu3(responseResource), true);
|
||||
converted = VersionConvertorFactory_30_40.convertResource(toDstu3(responseResource));
|
||||
} else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.R4) {
|
||||
converted = VersionConvertor_30_40.convertResource(toR4(responseResource), true);
|
||||
converted = VersionConvertorFactory_30_40.convertResource(toR4(responseResource));
|
||||
} else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.R4) {
|
||||
converted = VersionConvertor_10_40.convertResource(toR4(responseResource), advisor40);
|
||||
converted = VersionConvertorFactory_10_40.convertResource(toR4(responseResource), advisor40);
|
||||
} else if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU2) {
|
||||
converted = VersionConvertor_10_40.convertResource(toDstu2(responseResource), advisor40);
|
||||
converted = VersionConvertorFactory_10_40.convertResource(toDstu2(responseResource), advisor40);
|
||||
} else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.DSTU3) {
|
||||
converted = VersionConvertor_10_30.convertResource(toDstu3(responseResource), advisor30);
|
||||
converted = VersionConvertorFactory_10_30.convertResource(toDstu3(responseResource), advisor30);
|
||||
} else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.DSTU2) {
|
||||
converted = VersionConvertor_10_30.convertResource(toDstu2(responseResource), advisor30);
|
||||
converted = VersionConvertorFactory_10_30.convertResource(toDstu2(responseResource), advisor30);
|
||||
}
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
|
|
|
@ -20,8 +20,7 @@ package org.hl7.fhir.converter;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
|
@ -31,7 +30,7 @@ import org.hl7.fhir.r5.model.FhirPublication;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class NullVersionConverterAdvisor30 implements VersionConvertorAdvisor30 {
|
||||
public class NullVersionConverterAdvisor10_30 extends BaseAdvisor_10_30 {
|
||||
|
||||
|
||||
@Nullable
|
|
@ -20,8 +20,7 @@ package org.hl7.fhir.converter;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
|
@ -31,7 +30,7 @@ import org.hl7.fhir.r5.model.FhirPublication;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class NullVersionConverterAdvisor40 implements VersionConvertorAdvisor40 {
|
||||
public class NullVersionConverterAdvisor10_40 extends BaseAdvisor_10_40 {
|
||||
|
||||
|
||||
@Nullable
|
|
@ -20,8 +20,8 @@ package org.hl7.fhir.converter;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
|
@ -32,7 +32,7 @@ import javax.annotation.Nonnull;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.IdentityHashMap;
|
||||
|
||||
public class NullVersionConverterAdvisor50 implements VersionConvertorAdvisor50 {
|
||||
public class NullVersionConverterAdvisor10_50 extends BaseAdvisor_10_50 {
|
||||
|
||||
private IdentityHashMap<ValueSet, CodeSystem> myCodeSystems = new IdentityHashMap<>();
|
||||
|
|
@ -2,7 +2,7 @@ package org.hl7.fhir.converter;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
|
@ -19,7 +19,7 @@ public class VersionConvertor_10_30Test {
|
|||
org.hl7.fhir.dstu2.model.Observation input = new org.hl7.fhir.dstu2.model.Observation();
|
||||
input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123"));
|
||||
|
||||
org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertor_10_30.convertResource(input);
|
||||
org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertorFactory_10_30.convertResource(input);
|
||||
String context = output.getContext().getReference();
|
||||
|
||||
assertEquals("Encounter/123", context);
|
||||
|
@ -52,7 +52,7 @@ public class VersionConvertor_10_30Test {
|
|||
Specimen.SpecimenContainerComponent specimenContainerComponent = new Specimen.SpecimenContainerComponent();
|
||||
specimenContainerComponent.getExtension().add(new Extension().setUrl("some_url").setValue(new StringType("some_value")));
|
||||
spec.setContainer(Collections.singletonList(specimenContainerComponent));
|
||||
Resource resource = VersionConvertor_10_30.convertResource(spec);
|
||||
Resource resource = VersionConvertorFactory_10_30.convertResource(spec);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.hl7.fhir.converter;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_14_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30;
|
||||
import org.hl7.fhir.dstu3.model.Questionnaire;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -15,7 +15,7 @@ public class VersionConvertor_14_30Test {
|
|||
org.hl7.fhir.dstu2016may.model.Questionnaire input = new org.hl7.fhir.dstu2016may.model.Questionnaire();
|
||||
input.setTitle("My title");
|
||||
|
||||
org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertor_14_30.convertResource(input);
|
||||
org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertorFactory_14_30.convertResource(input);
|
||||
String context = output.getTitle();
|
||||
|
||||
assertEquals("My title", context);
|
||||
|
|
|
@ -20,8 +20,10 @@ package ca.uhn.hapi.fhir.docs;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.convertors.conv10_30.Observation10_30;
|
||||
import org.hl7.fhir.convertors.conv14_30.Questionnaire14_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30;
|
||||
import org.hl7.fhir.dstu3.model.Observation;
|
||||
import org.hl7.fhir.dstu3.model.Questionnaire;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class ConverterExamples {
|
||||
|
@ -34,7 +36,7 @@ public class ConverterExamples {
|
|||
input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123"));
|
||||
|
||||
// Convert the resource
|
||||
org.hl7.fhir.dstu3.model.Observation output = Observation10_30.convertObservation(input);
|
||||
org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertorFactory_10_30.convertResource(input);
|
||||
String context = output.getContext().getReference();
|
||||
//END SNIPPET: 1020
|
||||
}
|
||||
|
@ -47,7 +49,7 @@ public class ConverterExamples {
|
|||
input.setTitle("My title");
|
||||
|
||||
// Convert the resource
|
||||
org.hl7.fhir.dstu3.model.Questionnaire output = Questionnaire14_30.convertQuestionnaire(input);
|
||||
org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertorFactory_14_30.convertResource(input);
|
||||
String context = output.getTitle();
|
||||
//END SNIPPET: 1420
|
||||
}
|
||||
|
|
|
@ -22,22 +22,13 @@ package ca.uhn.fhir.jpa.dao;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSearchParameter;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoSearchParameterR4;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
|
||||
import ca.uhn.fhir.model.dstu2.resource.SearchParameter;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import org.hl7.fhir.convertors.conv10_40.SearchParameter10_40;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
|
@ -79,7 +70,7 @@ public class FhirResourceDaoSearchParameterDstu2 extends BaseHapiFhirResourceDao
|
|||
String encoded = getContext().newJsonParser().encodeResourceToString(theResource);
|
||||
org.hl7.fhir.dstu2.model.SearchParameter hl7Org = myDstu2Hl7OrgContext.newJsonParser().parseResource(org.hl7.fhir.dstu2.model.SearchParameter.class, encoded);
|
||||
|
||||
org.hl7.fhir.r4.model.SearchParameter convertedSp = SearchParameter10_40.convertSearchParameter(hl7Org);
|
||||
org.hl7.fhir.r4.model.SearchParameter convertedSp = (org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_10_40.convertResource(hl7Org);
|
||||
if (isBlank(convertedSp.getExpression()) && isNotBlank(hl7Org.getXpath())) {
|
||||
convertedSp.setExpression(hl7Org.getXpath());
|
||||
}
|
||||
|
|
|
@ -27,16 +27,17 @@ import ca.uhn.fhir.context.support.ValidationSupportContext;
|
|||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
||||
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
||||
import ca.uhn.fhir.jpa.util.LogicUtil;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
|
@ -53,7 +54,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem;
|
||||
|
||||
@Transactional
|
||||
public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao<CodeSystem> implements IFhirResourceDaoCodeSystem<CodeSystem, Coding, CodeableConcept> {
|
||||
|
@ -146,7 +146,7 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao<Code
|
|||
|
||||
CodeSystem csDstu3 = (CodeSystem) theResource;
|
||||
|
||||
org.hl7.fhir.r4.model.CodeSystem cs = convertCodeSystem(csDstu3);
|
||||
org.hl7.fhir.r4.model.CodeSystem cs = (org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_30_40.convertResource(csDstu3);
|
||||
addPidToResource(theEntity, cs);
|
||||
|
||||
myTerminologyCodeSystemStorageSvc.storeNewCodeSystemVersionIfNeeded(cs, (ResourceTable) theEntity);
|
||||
|
|
|
@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.dao.dstu3;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap;
|
||||
import ca.uhn.fhir.jpa.api.model.TranslationRequest;
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
|
@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.ConceptMap;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -37,8 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap;
|
||||
|
||||
public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao<ConceptMap> implements IFhirResourceDaoConceptMap<ConceptMap> {
|
||||
@Autowired
|
||||
private ITermConceptMappingSvc myTermConceptMappingSvc;
|
||||
|
@ -53,7 +52,6 @@ public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao<Conc
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceTable updateEntity(RequestDetails theRequestDetails, IBaseResource theResource, IBasePersistedResource theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing,
|
||||
boolean theUpdateVersion, TransactionDetails theTransactionDetails, boolean theForceUpdate, boolean theCreateNewHistoryEntry) {
|
||||
|
@ -63,7 +61,7 @@ public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao<Conc
|
|||
if (retVal.getDeleted() == null) {
|
||||
try {
|
||||
ConceptMap conceptMap = (ConceptMap) theResource;
|
||||
org.hl7.fhir.r4.model.ConceptMap converted = convertConceptMap(conceptMap);
|
||||
org.hl7.fhir.r4.model.ConceptMap converted = (org.hl7.fhir.r4.model.ConceptMap) VersionConvertorFactory_30_40.convertResource(conceptMap);
|
||||
myTermConceptMappingSvc.storeTermConceptMapAndChildren(retVal, converted);
|
||||
} catch (FHIRException fe) {
|
||||
throw new InternalErrorException(fe);
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package ca.uhn.fhir.jpa.dao.dstu3;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSearchParameter;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoSearchParameterR4;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
|
||||
import org.hl7.fhir.convertors.conv10_40.SearchParameter10_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.SearchParameter30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeType;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.SearchParameter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
|
@ -69,7 +63,9 @@ public class FhirResourceDaoSearchParameterDstu3 extends BaseHapiFhirResourceDao
|
|||
protected void validateResourceForStorage(SearchParameter theResource, ResourceTable theEntityToSave) {
|
||||
super.validateResourceForStorage(theResource, theEntityToSave);
|
||||
|
||||
FhirResourceDaoSearchParameterR4.validateSearchParam(SearchParameter30_40.convertSearchParameter(theResource), getContext(), getConfig(), mySearchParamRegistry, mySearchParamExtractor);
|
||||
FhirResourceDaoSearchParameterR4.validateSearchParam(
|
||||
(org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_30_40.convertResource(theResource),
|
||||
getContext(), getConfig(), mySearchParamRegistry, mySearchParamExtractor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import org.hl7.fhir.convertors.conv30_40.ValueSet30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
|
@ -42,7 +42,6 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|||
import java.util.Date;
|
||||
|
||||
import static ca.uhn.fhir.jpa.dao.FhirResourceDaoValueSetDstu2.toStringOrNull;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet;
|
||||
|
||||
public class FhirResourceDaoValueSetDstu3 extends BaseHapiFhirResourceDao<ValueSet> implements IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> {
|
||||
|
||||
|
@ -54,15 +53,15 @@ public class FhirResourceDaoValueSetDstu3 extends BaseHapiFhirResourceDao<ValueS
|
|||
|
||||
@Override
|
||||
public org.hl7.fhir.dstu3.model.ValueSet expand(org.hl7.fhir.dstu3.model.ValueSet theSource, ValueSetExpansionOptions theOptions) {
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalInput = ValueSet30_40.convertValueSet(theSource);
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalInput = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(theSource);
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, canonicalInput);
|
||||
return ValueSet30_40.convertValueSet(canonicalOutput);
|
||||
return (ValueSet) VersionConvertorFactory_30_40.convertResource(canonicalOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.hl7.fhir.dstu3.model.ValueSet expandByIdentifier(String theUri, ValueSetExpansionOptions theOptions) {
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, theUri);
|
||||
return ValueSet30_40.convertValueSet(canonicalOutput);
|
||||
return (ValueSet) VersionConvertorFactory_30_40.convertResource(canonicalOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +85,7 @@ public class FhirResourceDaoValueSetDstu3 extends BaseHapiFhirResourceDao<ValueS
|
|||
if (retVal.getDeleted() == null) {
|
||||
try {
|
||||
ValueSet valueSet = (ValueSet) theResource;
|
||||
org.hl7.fhir.r4.model.ValueSet converted = convertValueSet(valueSet);
|
||||
org.hl7.fhir.r4.model.ValueSet converted = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(valueSet);
|
||||
myTerminologySvc.storeTermValueSet(retVal, converted);
|
||||
} catch (FHIRException fe) {
|
||||
throw new InternalErrorException(fe);
|
||||
|
|
|
@ -38,6 +38,7 @@ import ca.uhn.fhir.jpa.util.LogicUtil;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
@ -149,7 +150,7 @@ public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao<CodeSys
|
|||
CodeSystem cs = (CodeSystem) theResource;
|
||||
addPidToResource(theEntity, theResource);
|
||||
|
||||
myTerminologyCodeSystemStorageSvc.storeNewCodeSystemVersionIfNeeded(org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem(cs), (ResourceTable) theEntity);
|
||||
myTerminologyCodeSystemStorageSvc.storeNewCodeSystemVersionIfNeeded((org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_40_50.convertResource(cs), (ResourceTable) theEntity);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -29,6 +29,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
|||
import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.ConceptMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -56,7 +57,8 @@ public class FhirResourceDaoConceptMapR5 extends BaseHapiFhirResourceDao<Concept
|
|||
|
||||
if (retVal.getDeleted() == null) {
|
||||
ConceptMap conceptMap = (ConceptMap) theResource;
|
||||
myTermConceptMappingSvc.storeTermConceptMapAndChildren(retVal, org.hl7.fhir.convertors.conv40_50.ConceptMap40_50.convertConceptMap(conceptMap));
|
||||
myTermConceptMappingSvc.storeTermConceptMapAndChildren(retVal,
|
||||
(org.hl7.fhir.r4.model.ConceptMap) VersionConvertorFactory_40_50.convertResource(conceptMap));
|
||||
} else {
|
||||
myTermConceptMappingSvc.deleteConceptMapAndChildren(retVal);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
package ca.uhn.fhir.jpa.dao.r5;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSearchParameter;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoSearchParameterR4;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
|
||||
import org.hl7.fhir.convertors.conv30_40.SearchParameter30_40;
|
||||
import org.hl7.fhir.convertors.conv40_50.SearchParameter40_50;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.r5.model.SearchParameter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
|
@ -68,7 +63,9 @@ public class FhirResourceDaoSearchParameterR5 extends BaseHapiFhirResourceDao<Se
|
|||
protected void validateResourceForStorage(SearchParameter theResource, ResourceTable theEntityToSave) {
|
||||
super.validateResourceForStorage(theResource, theEntityToSave);
|
||||
|
||||
FhirResourceDaoSearchParameterR4.validateSearchParam(SearchParameter40_50.convertSearchParameter(theResource), getContext(), getConfig(), mySearchParamRegistry, mySearchParamExtractor);
|
||||
FhirResourceDaoSearchParameterR4.validateSearchParam(
|
||||
(org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_40_50.convertResource(theResource),
|
||||
getContext(), getConfig(), mySearchParamRegistry, mySearchParamExtractor);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
|
|||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||
import org.hl7.fhir.convertors.conv40_50.ValueSet40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
@ -52,14 +52,14 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao<ValueSet>
|
|||
@Override
|
||||
public ValueSet expandByIdentifier(String theUri, ValueSetExpansionOptions theOptions) {
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, theUri);
|
||||
return ValueSet40_50.convertValueSet(canonicalOutput);
|
||||
return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expand(ValueSet theSource, ValueSetExpansionOptions theOptions) {
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalInput = ValueSet40_50.convertValueSet(theSource);
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalInput = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theSource);
|
||||
org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, canonicalInput);
|
||||
return ValueSet40_50.convertValueSet(canonicalOutput);
|
||||
return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao<ValueSet>
|
|||
if (getConfig().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) {
|
||||
if (retVal.getDeleted() == null) {
|
||||
ValueSet valueSet = (ValueSet) theResource;
|
||||
myTerminologySvc.storeTermValueSet(retVal, org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSet));
|
||||
myTerminologySvc.storeTermValueSet(retVal, (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet));
|
||||
} else {
|
||||
myTerminologySvc.deleteValueSetAndChildren(retVal);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ import ca.uhn.fhir.util.ValidateUtil;
|
|||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
@ -58,10 +60,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.trim;
|
||||
import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
public class TerminologyUploaderProvider extends BaseJpaProvider {
|
||||
|
||||
|
@ -308,10 +307,10 @@ public class TerminologyUploaderProvider extends BaseJpaProvider {
|
|||
CodeSystem nextCodeSystem;
|
||||
switch (getContext().getVersion().getVersion()) {
|
||||
case DSTU3:
|
||||
nextCodeSystem = convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem);
|
||||
nextCodeSystem = (CodeSystem) VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem);
|
||||
break;
|
||||
case R5:
|
||||
nextCodeSystem = org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem);
|
||||
nextCodeSystem = (CodeSystem) VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem);
|
||||
break;
|
||||
default:
|
||||
nextCodeSystem = (CodeSystem) theCodeSystem;
|
||||
|
|
|
@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.provider.dstu3;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap;
|
||||
import ca.uhn.fhir.jpa.api.model.TranslationRequest;
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||
import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
|
@ -31,7 +31,7 @@ import ca.uhn.fhir.rest.annotation.OperationParam;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||
import org.hl7.fhir.dstu3.model.CodeType;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
|
@ -45,8 +45,6 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters;
|
||||
|
||||
public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderDstu3<ConceptMap> {
|
||||
@Operation(name = JpaConstants.OPERATION_TRANSLATE, idempotent = true, returnParameters = {
|
||||
@OperationParam(name = "result", type = BooleanType.class, min = 1, max = 1),
|
||||
|
@ -102,44 +100,44 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD
|
|||
try {
|
||||
|
||||
if (haveUrl) {
|
||||
translationRequest.setUrl(VersionConvertor_30_40.convertUri(theUrl));
|
||||
translationRequest.setUrl((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theUrl));
|
||||
}
|
||||
|
||||
if (haveConceptMapVersion) {
|
||||
translationRequest.setConceptMapVersion(VersionConvertor_30_40.convertString(theConceptMapVersion));
|
||||
translationRequest.setConceptMapVersion((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theConceptMapVersion));
|
||||
}
|
||||
|
||||
// Convert from DSTU3 to R4
|
||||
if (haveSourceCode) {
|
||||
translationRequest.getCodeableConcept().addCoding().setCodeElement(VersionConvertor_30_40.convertCode(theSourceCode));
|
||||
translationRequest.getCodeableConcept().addCoding().setCodeElement((org.hl7.fhir.r4.model.CodeType) VersionConvertorFactory_30_40.convertType(theSourceCode));
|
||||
|
||||
if (haveSourceCodeSystem) {
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement(VersionConvertor_30_40.convertUri(theSourceCodeSystem));
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystem));
|
||||
}
|
||||
|
||||
if (haveSourceCodeSystemVersion) {
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement(VersionConvertor_30_40.convertString(theSourceCodeSystemVersion));
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystemVersion));
|
||||
}
|
||||
} else if (haveSourceCoding) {
|
||||
translationRequest.getCodeableConcept().addCoding(VersionConvertor_30_40.convertCoding(theSourceCoding));
|
||||
translationRequest.getCodeableConcept().addCoding((org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType(theSourceCoding));
|
||||
} else {
|
||||
translationRequest.setCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(theSourceCodeableConcept));
|
||||
translationRequest.setCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType(theSourceCodeableConcept));
|
||||
}
|
||||
|
||||
if (haveSourceValueSet) {
|
||||
translationRequest.setSource(VersionConvertor_30_40.convertUri(theSourceValueSet));
|
||||
translationRequest.setSource((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceValueSet));
|
||||
}
|
||||
|
||||
if (haveTargetValueSet) {
|
||||
translationRequest.setTarget(VersionConvertor_30_40.convertUri(theTargetValueSet));
|
||||
translationRequest.setTarget((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetValueSet));
|
||||
}
|
||||
|
||||
if (haveTargetCodeSystem) {
|
||||
translationRequest.setTargetSystem(VersionConvertor_30_40.convertUri(theTargetCodeSystem));
|
||||
translationRequest.setTargetSystem((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetCodeSystem));
|
||||
}
|
||||
|
||||
if (haveReverse) {
|
||||
translationRequest.setReverse(VersionConvertor_30_40.convertBoolean(theReverse));
|
||||
translationRequest.setReverse((org.hl7.fhir.r4.model.BooleanType) VersionConvertorFactory_30_40.convertType(theReverse));
|
||||
}
|
||||
|
||||
if (haveId) {
|
||||
|
@ -155,7 +153,7 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD
|
|||
TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails);
|
||||
|
||||
// Convert from R4 to DSTU3
|
||||
return convertParameters(TermConceptMappingSvcImpl.toParameters(result));
|
||||
return (Parameters) VersionConvertorFactory_30_40.convertResource(TermConceptMappingSvcImpl.toParameters(result));
|
||||
} catch (FHIRException fe) {
|
||||
throw new InternalErrorException(fe);
|
||||
} finally {
|
||||
|
|
|
@ -24,8 +24,6 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
|||
import ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
|
||||
import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters;
|
||||
|
||||
public class JpaResourceProviderDstu3<T extends IAnyResource> extends BaseJpaResourceProvider<T> {
|
||||
|
||||
public JpaResourceProviderDstu3() {
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Map.Entry;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
|
|
@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.provider.r5;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap;
|
||||
import ca.uhn.fhir.jpa.api.model.TranslationRequest;
|
||||
import ca.uhn.fhir.context.support.TranslateConceptResults;
|
||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||
import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
|
@ -30,7 +30,7 @@ import ca.uhn.fhir.rest.annotation.Operation;
|
|||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
|
@ -97,43 +97,44 @@ public class BaseJpaResourceProviderConceptMapR5 extends JpaResourceProviderR5<C
|
|||
TranslationRequest translationRequest = new TranslationRequest();
|
||||
|
||||
if (haveUrl) {
|
||||
translationRequest.setUrl(VersionConvertor_40_50.convertUri(theUrl));
|
||||
translationRequest.setUrl((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_40_50.convertType(theUrl));
|
||||
}
|
||||
|
||||
if (haveConceptMapVersion) {
|
||||
translationRequest.setConceptMapVersion(VersionConvertor_40_50.convertString(theConceptMapVersion));
|
||||
translationRequest.setConceptMapVersion((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_40_50.convertType(theConceptMapVersion));
|
||||
}
|
||||
|
||||
if (haveSourceCode) {
|
||||
translationRequest.getCodeableConcept().addCoding().setCodeElement(VersionConvertor_40_50.convertCode(theSourceCode));
|
||||
translationRequest.getCodeableConcept().addCoding().setCodeElement((org.hl7.fhir.r4.model.CodeType) VersionConvertorFactory_40_50.convertType(theSourceCode));
|
||||
|
||||
if (haveSourceCodeSystem) {
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement(VersionConvertor_40_50.convertUri(theSourceCodeSystem));
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_40_50.convertType(theSourceCodeSystem));
|
||||
}
|
||||
|
||||
if (haveSourceCodeSystemVersion) {
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement(VersionConvertor_40_50.convertString(theSourceCodeSystemVersion));
|
||||
translationRequest.getCodeableConcept().getCodingFirstRep()
|
||||
.setVersionElement((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_40_50.convertType(theSourceCodeSystemVersion));
|
||||
}
|
||||
} else if (haveSourceCoding) {
|
||||
translationRequest.getCodeableConcept().addCoding(VersionConvertor_40_50.convertCoding(theSourceCoding));
|
||||
translationRequest.getCodeableConcept().addCoding((org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_40_50.convertType(theSourceCoding));
|
||||
} else {
|
||||
translationRequest.setCodeableConcept(VersionConvertor_40_50.convertCodeableConcept(theSourceCodeableConcept));
|
||||
translationRequest.setCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_40_50.convertType(theSourceCodeableConcept));
|
||||
}
|
||||
|
||||
if (haveSourceValueSet) {
|
||||
translationRequest.setSource(VersionConvertor_40_50.convertUri(theSourceValueSet));
|
||||
translationRequest.setSource((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_40_50.convertType(theSourceValueSet));
|
||||
}
|
||||
|
||||
if (haveTargetValueSet) {
|
||||
translationRequest.setTarget(VersionConvertor_40_50.convertUri(theTargetValueSet));
|
||||
translationRequest.setTarget((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_40_50.convertType(theTargetValueSet));
|
||||
}
|
||||
|
||||
if (haveTargetCodeSystem) {
|
||||
translationRequest.setTargetSystem(VersionConvertor_40_50.convertUri(theTargetCodeSystem));
|
||||
translationRequest.setTargetSystem((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_40_50.convertType(theTargetCodeSystem));
|
||||
}
|
||||
|
||||
if (haveReverse) {
|
||||
translationRequest.setReverse(VersionConvertor_40_50.convertBoolean(theReverse));
|
||||
translationRequest.setReverse((org.hl7.fhir.r4.model.BooleanType) VersionConvertorFactory_40_50.convertType(theReverse));
|
||||
}
|
||||
|
||||
if (haveId) {
|
||||
|
@ -145,7 +146,7 @@ public class BaseJpaResourceProviderConceptMapR5 extends JpaResourceProviderR5<C
|
|||
IFhirResourceDaoConceptMap<ConceptMap> dao = (IFhirResourceDaoConceptMap<ConceptMap>) getDao();
|
||||
TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails);
|
||||
org.hl7.fhir.r4.model.Parameters parameters = TermConceptMappingSvcImpl.toParameters(result);
|
||||
return org.hl7.fhir.convertors.conv40_50.Parameters40_50.convertParameters(parameters);
|
||||
return (Parameters) VersionConvertorFactory_40_50.convertResource(parameters);
|
||||
} finally {
|
||||
endRequest(theServletRequest);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
|||
import ca.uhn.fhir.jpa.term.api.ITermReadSvcDstu3;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.util.ValidateUtil;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.CodeSystem30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
|
@ -25,8 +24,6 @@ import org.springframework.transaction.PlatformTransactionManager;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
|
@ -67,7 +64,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation
|
|||
org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4;
|
||||
valueSetToExpandR4 = toCanonicalValueSet(theValueSetToExpand);
|
||||
org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, valueSetToExpandR4);
|
||||
return new ValueSetExpansionOutcome(convertValueSet(expandedR4), null);
|
||||
return new ValueSetExpansionOutcome(VersionConvertorFactory_30_40.convertResource(expandedR4), null);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
@ -81,7 +78,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation
|
|||
org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4;
|
||||
valueSetToExpandR4 = toCanonicalValueSet(valueSetToExpand);
|
||||
org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, valueSetToExpandR4);
|
||||
return convertValueSet(expandedR4);
|
||||
return VersionConvertorFactory_30_40.convertResource(expandedR4);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
@ -90,31 +87,31 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation
|
|||
@Override
|
||||
protected org.hl7.fhir.r4.model.ValueSet toCanonicalValueSet(IBaseResource theValueSet) throws FHIRException {
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4;
|
||||
valueSetToExpandR4 = convertValueSet((ValueSet) theValueSet);
|
||||
valueSetToExpandR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource((ValueSet) theValueSet);
|
||||
return valueSetToExpandR4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected org.hl7.fhir.r4.model.CodeSystem toCanonicalCodeSystem(IBaseResource theCodeSystem) {
|
||||
return CodeSystem30_40.convertCodeSystem((CodeSystem)theCodeSystem);
|
||||
return (org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_30_40.convertResource((CodeSystem)theCodeSystem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseDatatype theCoding) {
|
||||
return VersionConvertor_30_40.convertCoding((org.hl7.fhir.dstu3.model.Coding) theCoding);
|
||||
return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType((Coding) theCoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseCoding theCoding) {
|
||||
return VersionConvertor_30_40.convertCoding((org.hl7.fhir.dstu3.model.Coding) theCoding);
|
||||
return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType((org.hl7.fhir.dstu3.model.Coding) theCoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.CodeableConcept toCanonicalCodeableConcept(IBaseDatatype theCoding) {
|
||||
return VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) theCoding);
|
||||
return (org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType((CodeableConcept) theCoding);
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +157,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation
|
|||
public IValidationSupport.CodeValidationResult validateCodeIsInPreExpandedValueSet(ConceptValidationOptions theOptions, IBaseResource theValueSet, String theSystem, String theCode, String theDisplay, IBaseDatatype theCoding, IBaseDatatype theCodeableConcept) {
|
||||
ValidateUtil.isNotNullOrThrowUnprocessableEntity(theValueSet, "ValueSet must not be null");
|
||||
ValueSet valueSet = (ValueSet) theValueSet;
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetR4 = convertValueSet(valueSet);
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(valueSet);
|
||||
|
||||
Coding coding = (Coding) theCoding;
|
||||
org.hl7.fhir.r4.model.Coding codingR4 = null;
|
||||
|
@ -184,7 +181,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation
|
|||
public boolean isValueSetPreExpandedForCodeValidation(IBaseResource theValueSet) {
|
||||
ValidateUtil.isNotNullOrThrowUnprocessableEntity(theValueSet, "ValueSet must not be null");
|
||||
ValueSet valueSet = (ValueSet) theValueSet;
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetR4 = convertValueSet(valueSet);
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(valueSet);
|
||||
return super.isValueSetPreExpandedForCodeValidation(valueSetR4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
|||
import ca.uhn.fhir.jpa.term.api.ITermReadSvcR5;
|
||||
import ca.uhn.fhir.jpa.term.ex.ExpansionTooCostlyException;
|
||||
import ca.uhn.fhir.util.ValidateUtil;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.CodeSystem40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -19,8 +18,6 @@ import org.hl7.fhir.r5.model.CodeSystem;
|
|||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
|
@ -59,15 +56,16 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup
|
|||
@Transactional(dontRollbackOn = {ExpansionTooCostlyException.class})
|
||||
public ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, ValueSetExpansionOptions theExpansionOptions, @Nonnull IBaseResource theValueSetToExpand) {
|
||||
ValueSet valueSetToExpand = (ValueSet) theValueSetToExpand;
|
||||
org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetToExpand));
|
||||
return new ValueSetExpansionOutcome(org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(expandedR4));
|
||||
org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions,
|
||||
(org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSetToExpand));
|
||||
return new ValueSetExpansionOutcome(VersionConvertorFactory_40_50.convertResource(expandedR4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseResource expandValueSet(ValueSetExpansionOptions theExpansionOptions, IBaseResource theInput) {
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetToExpand = toCanonicalValueSet(theInput);
|
||||
org.hl7.fhir.r4.model.ValueSet valueSetR4 = super.expandValueSet(theExpansionOptions, valueSetToExpand);
|
||||
return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetR4);
|
||||
return VersionConvertorFactory_40_50.convertResource(valueSetR4);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +77,7 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup
|
|||
@Override
|
||||
protected org.hl7.fhir.r4.model.ValueSet getValueSetFromResourceTable(ResourceTable theResourceTable) {
|
||||
ValueSet valueSetR5 = myDaoRegistry.getResourceDao("ValueSet").toResource(ValueSet.class, theResourceTable, null, false);
|
||||
return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetR5);
|
||||
return (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSetR5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,30 +108,30 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup
|
|||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseDatatype theCoding) {
|
||||
return VersionConvertor_40_50.convertCoding((Coding) theCoding);
|
||||
return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_40_50.convertType((Coding) theCoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseCoding theCoding) {
|
||||
return VersionConvertor_40_50.convertCoding((Coding) theCoding);
|
||||
return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_40_50.convertType((Coding) theCoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected org.hl7.fhir.r4.model.CodeableConcept toCanonicalCodeableConcept(IBaseDatatype theCoding) {
|
||||
return VersionConvertor_40_50.convertCodeableConcept((CodeableConcept) theCoding);
|
||||
return (org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_40_50.convertType((CodeableConcept) theCoding);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected org.hl7.fhir.r4.model.ValueSet toCanonicalValueSet(IBaseResource theValueSet) throws org.hl7.fhir.exceptions.FHIRException {
|
||||
return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet((ValueSet) theValueSet);
|
||||
return (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource((ValueSet) theValueSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected org.hl7.fhir.r4.model.CodeSystem toCanonicalCodeSystem(IBaseResource theCodeSystem) {
|
||||
return CodeSystem40_50.convertCodeSystem((CodeSystem) theCodeSystem);
|
||||
return (org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_40_50.convertResource((CodeSystem) theCodeSystem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,7 @@ import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.ConceptMap;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
|
@ -36,9 +37,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
|||
import org.springframework.context.event.EventListener;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap;
|
||||
import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet;
|
||||
|
||||
public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl implements ITermVersionAdapterSvc {
|
||||
|
||||
|
@ -56,7 +54,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im
|
|||
|
||||
/**
|
||||
* Initialize the beans that are used by this service.
|
||||
*
|
||||
* <p>
|
||||
* Note: There is a circular dependency here where the CodeSystem DAO
|
||||
* needs terminology services, and the term services need the CodeSystem DAO.
|
||||
* So we look these up in a refresh event instead of just autowiring them
|
||||
|
@ -74,7 +72,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im
|
|||
public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) {
|
||||
CodeSystem resourceToStore;
|
||||
try {
|
||||
resourceToStore = convertCodeSystem(theCodeSystemResource);
|
||||
resourceToStore = (CodeSystem) VersionConvertorFactory_30_40.convertResource(theCodeSystemResource);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
@ -91,7 +89,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im
|
|||
public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) {
|
||||
ConceptMap resourceToStore;
|
||||
try {
|
||||
resourceToStore = convertConceptMap(theConceptMap);
|
||||
resourceToStore = (ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
@ -107,7 +105,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im
|
|||
public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) {
|
||||
ValueSet valueSetDstu3;
|
||||
try {
|
||||
valueSetDstu3 = convertValueSet(theValueSet);
|
||||
valueSetDstu3 = (ValueSet) VersionConvertorFactory_30_40.convertResource(theValueSet);
|
||||
} catch (FHIRException e) {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
|||
import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ConceptMap;
|
||||
|
@ -63,7 +64,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple
|
|||
public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) {
|
||||
validateCodeSystemForStorage(theCodeSystemResource);
|
||||
|
||||
CodeSystem codeSystemR4 = org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem(theCodeSystemResource);
|
||||
CodeSystem codeSystemR4 = (CodeSystem) VersionConvertorFactory_40_50.convertResource(theCodeSystemResource);
|
||||
if (isBlank(theCodeSystemResource.getIdElement().getIdPart())) {
|
||||
String matchUrl = "CodeSystem?url=" + UrlUtil.escapeUrlParam(theCodeSystemResource.getUrl());
|
||||
return myCodeSystemResourceDao.update(codeSystemR4, matchUrl, theRequestDetails).getId();
|
||||
|
@ -75,7 +76,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple
|
|||
@Override
|
||||
public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) {
|
||||
|
||||
ConceptMap conceptMapR4 = org.hl7.fhir.convertors.conv40_50.ConceptMap40_50.convertConceptMap(theConceptMap);
|
||||
ConceptMap conceptMapR4 = (ConceptMap) VersionConvertorFactory_40_50.convertResource(theConceptMap);
|
||||
|
||||
if (isBlank(theConceptMap.getIdElement().getIdPart())) {
|
||||
String matchUrl = "ConceptMap?url=" + UrlUtil.escapeUrlParam(theConceptMap.getUrl());
|
||||
|
@ -88,7 +89,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple
|
|||
@Override
|
||||
public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) {
|
||||
|
||||
ValueSet valueSetR4 = org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(theValueSet);
|
||||
ValueSet valueSetR4 = (ValueSet) VersionConvertorFactory_40_50.convertResource(theValueSet);
|
||||
|
||||
if (isBlank(theValueSet.getIdElement().getIdPart())) {
|
||||
String matchUrl = "ValueSet?url=" + UrlUtil.escapeUrlParam(theValueSet.getUrl());
|
||||
|
|
|
@ -27,7 +27,9 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r4.model.IdType;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
|
@ -39,6 +41,9 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ValidatorResourceFetcher implements IResourceValidator.IValidatorResourceFetcher {
|
||||
|
@ -60,10 +65,8 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe
|
|||
myVersionSpecificCOntextWrapper = VersionSpecificWorkerContextWrapper.newVersionSpecificWorkerContextWrapper(myValidationSupport);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Element fetch(Object appContext, String theUrl) throws FHIRException {
|
||||
|
||||
public Element fetch(IResourceValidator iResourceValidator, Object appContext, String theUrl) throws FHIRFormatError, DefinitionException, FHIRException, IOException {
|
||||
IdType id = new IdType(theUrl);
|
||||
String resourceType = id.getResourceType();
|
||||
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(resourceType);
|
||||
|
@ -83,7 +86,8 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public IResourceValidator.ReferenceValidationPolicy validationPolicy(Object appContext, String path, String url) {
|
||||
public IResourceValidator.ReferenceValidationPolicy validationPolicy(IResourceValidator iResourceValidator,
|
||||
Object appContext, String path, String url) {
|
||||
int slashIdx = url.indexOf("/");
|
||||
if (slashIdx > 0 && myFhirContext.getResourceTypes().contains(url.substring(0, slashIdx))) {
|
||||
return myValidationSettings.getLocalReferenceValidationDefaultPolicy();
|
||||
|
@ -93,12 +97,12 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean resolveURL(Object appContext, String path, String url, String type) throws FHIRException {
|
||||
public boolean resolveURL(IResourceValidator iResourceValidator, Object o, String s, String s1, String s2) throws IOException, FHIRException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] fetchRaw(String url) {
|
||||
public byte[] fetchRaw(IResourceValidator iResourceValidator, String s) throws MalformedURLException, IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -109,13 +113,12 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public CanonicalResource fetchCanonicalResource(String url) {
|
||||
throw new UnsupportedOperationException();
|
||||
public CanonicalResource fetchCanonicalResource(IResourceValidator iResourceValidator, String s) throws URISyntaxException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fetchesCanonicalResource(String url) {
|
||||
public boolean fetchesCanonicalResource(IResourceValidator iResourceValidator, String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
|
|||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||
import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc;
|
||||
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
|
||||
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
|
||||
import ca.uhn.fhir.jpa.term.BaseTermReadSvcImpl;
|
||||
import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl;
|
||||
|
@ -53,10 +52,12 @@ import ca.uhn.fhir.rest.api.Constants;
|
|||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
|
||||
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hibernate.search.mapper.orm.Search;
|
||||
import org.hibernate.search.mapper.orm.session.SearchSession;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.dstu3.model.AllergyIntolerance;
|
||||
import org.hl7.fhir.dstu3.model.Appointment;
|
||||
import org.hl7.fhir.dstu3.model.AuditEvent;
|
||||
|
@ -125,7 +126,6 @@ import java.io.InputStream;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
|
@ -462,7 +462,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
*/
|
||||
public static ConceptMap createConceptMap() {
|
||||
try {
|
||||
return convertConceptMap(BaseJpaR4Test.createConceptMap());
|
||||
return (ConceptMap) VersionConvertorFactory_30_40.convertResource(BaseJpaR4Test.createConceptMap());
|
||||
} catch (FHIRException fe) {
|
||||
throw new InternalErrorException(fe);
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ import io.swagger.v3.oas.models.responses.ApiResponses;
|
|||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.oas.models.tags.Tag;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
@ -78,7 +78,6 @@ import org.thymeleaf.IEngineConfiguration;
|
|||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.cache.AlwaysValidCacheEntryValidity;
|
||||
import org.thymeleaf.cache.ICacheEntryValidity;
|
||||
import org.thymeleaf.cache.NonCacheableCacheEntryValidity;
|
||||
import org.thymeleaf.context.IExpressionContext;
|
||||
import org.thymeleaf.context.WebContext;
|
||||
import org.thymeleaf.linkbuilder.AbstractLinkBuilder;
|
||||
|
@ -902,9 +901,9 @@ public class OpenApiInterceptor {
|
|||
private static <T extends Resource> T toCanonicalVersion(IBaseResource theNonCanonical) {
|
||||
IBaseResource canonical;
|
||||
if (theNonCanonical instanceof org.hl7.fhir.dstu3.model.Resource) {
|
||||
canonical = VersionConvertor_30_40.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical, true);
|
||||
canonical = VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical);
|
||||
} else if (theNonCanonical instanceof org.hl7.fhir.r5.model.Resource) {
|
||||
canonical = VersionConvertor_40_50.convertResource((org.hl7.fhir.r5.model.Resource) theNonCanonical);
|
||||
canonical = VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.Resource) theNonCanonical);
|
||||
} else {
|
||||
canonical = theNonCanonical;
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
import ca.uhn.fhir.util.ParametersUtil;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParametersInvalidException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
import ca.uhn.fhir.util.ParametersUtil;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParametersInvalidException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
|
@ -398,8 +398,8 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
|
|||
}
|
||||
|
||||
@Override
|
||||
public void cachePackage(PackageVersion packageDetails, List<PackageVersion> dependencies) {
|
||||
throw new UnsupportedOperationException();
|
||||
public void cachePackage(PackageDetails packageDetails, List<PackageVersion> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -442,6 +442,16 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPackage(PackageVersion packageVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageDetails getPackage(PackageVersion packageVersion) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClientRetryCount() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -457,6 +467,11 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageVersion getPackageForUrl(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ConceptValidationOptions convertConceptValidationOptions(ValidationOptions theOptions) {
|
||||
ConceptValidationOptions retVal = new ConceptValidationOptions();
|
||||
if (theOptions.isGuessSystem()) {
|
||||
|
|
|
@ -15,8 +15,9 @@ import org.apache.commons.lang3.Validate;
|
|||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.fhir.ucum.UcumException;
|
||||
import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.dstu2.model.ValueSet;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
|
@ -381,13 +382,13 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport {
|
|||
case DSTU2_1:
|
||||
return null;
|
||||
case DSTU3:
|
||||
normalized = VersionConvertor_30_40.convertResource(retVal, false);
|
||||
normalized = VersionConvertorFactory_30_40.convertResource(retVal, new BaseAdvisor_30_40(false));
|
||||
break;
|
||||
case R4:
|
||||
normalized = retVal;
|
||||
break;
|
||||
case R5:
|
||||
normalized = VersionConvertor_40_50.convertResource(retVal);
|
||||
normalized = VersionConvertorFactory_40_50.convertResource(retVal);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,9 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
|
|||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.util.FhirVersionIndependentConcept;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.convertors.conv10_50.ValueSet10_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.CodeSystem30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.ValueSet30_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.CodeSystem40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.ValueSet40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.dstu2.model.ValueSet;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
@ -67,15 +65,15 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
IBaseResource expansion;
|
||||
switch (myCtx.getVersion().getVersion()) {
|
||||
case DSTU2_HL7ORG: {
|
||||
expansion = ValueSet10_50.convertValueSet(expansionR5);
|
||||
expansion = VersionConvertorFactory_10_50.convertResource(expansionR5);
|
||||
break;
|
||||
}
|
||||
case DSTU3: {
|
||||
expansion = ValueSet30_50.convertValueSet(expansionR5);
|
||||
expansion = VersionConvertorFactory_30_50.convertResource(expansionR5);
|
||||
break;
|
||||
}
|
||||
case R4: {
|
||||
expansion = ValueSet40_50.convertValueSet(expansionR5);
|
||||
expansion = VersionConvertorFactory_40_50.convertResource(expansionR5);
|
||||
break;
|
||||
}
|
||||
case R5: {
|
||||
|
@ -358,10 +356,10 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
};
|
||||
Function<String, org.hl7.fhir.r5.model.ValueSet> valueSetLoader = t -> {
|
||||
org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t);
|
||||
return ValueSet10_50.convertValueSet(valueSet);
|
||||
return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSet);
|
||||
};
|
||||
|
||||
org.hl7.fhir.r5.model.ValueSet input = ValueSet10_50.convertValueSet(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode);
|
||||
return (output);
|
||||
}
|
||||
|
@ -372,7 +370,6 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
IParser parserHapi = FhirContext.forCached(FhirVersionEnum.DSTU2).newJsonParser();
|
||||
|
||||
Function<String, CodeSystem> codeSystemLoader = t -> {
|
||||
// ca.uhn.fhir.model.dstu2.resource.ValueSet codeSystem = (ca.uhn.fhir.model.dstu2.resource.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t);
|
||||
ca.uhn.fhir.model.dstu2.resource.ValueSet codeSystem = theInput;
|
||||
CodeSystem retVal = null;
|
||||
if (codeSystem != null) {
|
||||
|
@ -385,11 +382,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
Function<String, org.hl7.fhir.r5.model.ValueSet> valueSetLoader = t -> {
|
||||
ca.uhn.fhir.model.dstu2.resource.ValueSet valueSet = (ca.uhn.fhir.model.dstu2.resource.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t);
|
||||
org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(valueSet));
|
||||
return ValueSet10_50.convertValueSet(valueSetRi);
|
||||
return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi);
|
||||
};
|
||||
|
||||
org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(theInput));
|
||||
org.hl7.fhir.r5.model.ValueSet input = ValueSet10_50.convertValueSet(valueSetRi);
|
||||
org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi);
|
||||
org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode);
|
||||
return (output);
|
||||
}
|
||||
|
@ -442,14 +439,14 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
private org.hl7.fhir.r5.model.ValueSet expandValueSetDstu3(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.dstu3.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) {
|
||||
Function<String, org.hl7.fhir.r5.model.CodeSystem> codeSystemLoader = t -> {
|
||||
org.hl7.fhir.dstu3.model.CodeSystem codeSystem = (org.hl7.fhir.dstu3.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t);
|
||||
return CodeSystem30_50.convertCodeSystem(codeSystem);
|
||||
return (CodeSystem) VersionConvertorFactory_30_50.convertResource(codeSystem);
|
||||
};
|
||||
Function<String, org.hl7.fhir.r5.model.ValueSet> valueSetLoader = t -> {
|
||||
org.hl7.fhir.dstu3.model.ValueSet valueSet = (org.hl7.fhir.dstu3.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t);
|
||||
return ValueSet30_50.convertValueSet(valueSet);
|
||||
return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(valueSet);
|
||||
};
|
||||
|
||||
org.hl7.fhir.r5.model.ValueSet input = ValueSet30_50.convertValueSet(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode);
|
||||
return (output);
|
||||
}
|
||||
|
@ -458,14 +455,14 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu
|
|||
private org.hl7.fhir.r5.model.ValueSet expandValueSetR4(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.r4.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) {
|
||||
Function<String, org.hl7.fhir.r5.model.CodeSystem> codeSystemLoader = t -> {
|
||||
org.hl7.fhir.r4.model.CodeSystem codeSystem = (org.hl7.fhir.r4.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t);
|
||||
return CodeSystem40_50.convertCodeSystem(codeSystem);
|
||||
return (CodeSystem) VersionConvertorFactory_40_50.convertResource(codeSystem);
|
||||
};
|
||||
Function<String, org.hl7.fhir.r5.model.ValueSet> valueSetLoader = t -> {
|
||||
org.hl7.fhir.r4.model.ValueSet valueSet = (org.hl7.fhir.r4.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t);
|
||||
return ValueSet40_50.convertValueSet(valueSet);
|
||||
return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet);
|
||||
};
|
||||
|
||||
org.hl7.fhir.r5.model.ValueSet input = ValueSet40_50.convertValueSet(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theInput);
|
||||
org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode);
|
||||
return (output);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
|
|||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.fhir.ucum.UcumService;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
@ -144,6 +144,16 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPackage(PackageVersion packageVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageDetails getPackage(PackageVersion packageVersion) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClientRetryCount() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -159,6 +169,11 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageVersion getPackageForUrl(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSnapshot(StructureDefinition input) throws FHIRException {
|
||||
if (input.hasSnapshot()) {
|
||||
|
@ -226,7 +241,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void cachePackage(PackageVersion packageDetails, List<PackageVersion> dependencies) {
|
||||
public void cachePackage(PackageDetails packageDetails, List<PackageVersion> list) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -676,7 +691,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
|
|||
converter = new IVersionTypeConverter() {
|
||||
@Override
|
||||
public Resource toCanonical(IBaseResource theNonCanonical) {
|
||||
Resource retVal = VersionConvertor_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical);
|
||||
Resource retVal = VersionConvertorFactory_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical);
|
||||
if (theNonCanonical instanceof org.hl7.fhir.dstu2.model.ValueSet) {
|
||||
org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theNonCanonical;
|
||||
if (valueSet.hasCodeSystem() && valueSet.getCodeSystem().hasSystem()) {
|
||||
|
@ -691,7 +706,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
|
|||
|
||||
@Override
|
||||
public IBaseResource fromCanonical(Resource theCanonical) {
|
||||
return VersionConvertor_10_50.convertResource(theCanonical);
|
||||
return VersionConvertorFactory_10_50.convertResource(theCanonical);
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package org.hl7.fhir.common.hapi.validation.validator;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_14_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
|
||||
public class VersionTypeConverterDstu21 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter {
|
||||
@Override
|
||||
public Resource toCanonical(IBaseResource theNonCanonical) {
|
||||
return VersionConvertor_14_50.convertResource((org.hl7.fhir.dstu2016may.model.Resource) theNonCanonical);
|
||||
return VersionConvertorFactory_14_50.convertResource((org.hl7.fhir.dstu2016may.model.Resource) theNonCanonical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseResource fromCanonical(Resource theCanonical) {
|
||||
return VersionConvertor_14_50.convertResource(theCanonical);
|
||||
return VersionConvertorFactory_14_50.convertResource(theCanonical);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package org.hl7.fhir.common.hapi.validation.validator;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
|
||||
public class VersionTypeConverterDstu3 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter {
|
||||
@Override
|
||||
public Resource toCanonical(IBaseResource theNonCanonical) {
|
||||
return VersionConvertor_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical, true);
|
||||
return VersionConvertorFactory_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseResource fromCanonical(Resource theCanonical) {
|
||||
return VersionConvertor_30_50.convertResource(theCanonical, true);
|
||||
return VersionConvertorFactory_30_50.convertResource(theCanonical);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package org.hl7.fhir.common.hapi.validation.validator;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
|
||||
public class VersionTypeConverterR4 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter {
|
||||
@Override
|
||||
public Resource toCanonical(IBaseResource theNonCanonical) {
|
||||
return VersionConvertor_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical);
|
||||
return VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBaseResource fromCanonical(Resource theCanonical) {
|
||||
return VersionConvertor_40_50.convertResource(theCanonical);
|
||||
return VersionConvertorFactory_40_50.convertResource(theCanonical);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1312,13 +1312,13 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3-rick-test.json"), Charsets.UTF_8);
|
||||
|
||||
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
|
||||
when(resourceFetcher.validationPolicy(any(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
|
||||
myVal.validateWithResult(input);
|
||||
|
||||
verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).fetch(any(), anyString());
|
||||
verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).fetch(any(), anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1398,13 +1398,13 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
|||
String encoded = loadResource("/r4/r4-caredove-bundle.json");
|
||||
|
||||
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
|
||||
when(resourceFetcher.validationPolicy(any(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
|
||||
myVal.validateWithResult(encoded);
|
||||
|
||||
verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(12)).fetch(any(), anyString());
|
||||
verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(12)).fetch(any(), anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -428,13 +428,13 @@ public class FhirInstanceValidatorR5Test {
|
|||
String input = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream("/vitals.json"), Charsets.UTF_8);
|
||||
|
||||
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
|
||||
when(resourceFetcher.validationPolicy(any(),anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
|
||||
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
|
||||
myVal.validateWithResult(input);
|
||||
|
||||
verify(resourceFetcher, times(13)).resolveURL(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(3)).fetch(any(), anyString());
|
||||
verify(resourceFetcher, times(13)).resolveURL(any(), anyString(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString());
|
||||
verify(resourceFetcher, times(3)).fetch(any(), anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue