add filtering extensions to copyElement for v1.4

This commit is contained in:
Grahame Grieve 2019-12-19 10:46:55 +11:00
parent 89dfaec1de
commit 96a4bc7aac
3 changed files with 21 additions and 12 deletions

View File

@ -74,19 +74,23 @@ import org.hl7.fhir.utilities.Utilities;
public class VersionConvertor_14_30 {
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
tgt.addExtension(convertExtension(e));
if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) {
tgt.addExtension(convertExtension(e));
}
}
}
private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) {
tgt.addExtension(convertExtension(e));
if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) {
tgt.addExtension(convertExtension(e));
}
}
}

View File

@ -109,20 +109,23 @@ public class VersionConvertor_14_40 {
CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system");
}
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
if (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) {
tgt.addExtension(convertExtension(e));
}
}
}
private static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) {
tgt.addExtension(convertExtension(e));
if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) {
tgt.addExtension(convertExtension(e));
}
}
}

View File

@ -109,20 +109,22 @@ public class VersionConvertor_14_50 {
CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system");
}
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
if (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION))))
tgt.addExtension(convertExtension(e));
}
}
private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException {
private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId())
tgt.setId(src.getId());
for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) {
tgt.addExtension(convertExtension(e));
if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) {
tgt.addExtension(convertExtension(e));
}
}
}