diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_30.java index 178a9cda3..9391cd1d1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_30.java @@ -10,8 +10,6 @@ import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30; public class BaseAdvisor_10_30 extends BaseAdvisor30 { - private final List ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")); - public BaseAdvisor_10_30() { } @@ -21,6 +19,7 @@ public class BaseAdvisor_10_30 extends BaseAdvisor30 { - final List conformanceIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); private final List> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class)); public BaseAdvisor_10_40() { @@ -26,9 +25,8 @@ public class BaseAdvisor_10_40 extends BaseAdvisor40 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - return (lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url)); + // no globally ignored extensions here. + return false; } @Override diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_50.java index 5653a2dd7..8c1aca1c6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_10_50.java @@ -12,7 +12,7 @@ import org.hl7.fhir.r5.model.DataType; import org.hl7.fhir.r5.model.Expression; public class BaseAdvisor_10_50 extends BaseAdvisor50 { - final List conformanceIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); + private final List> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class)); public BaseAdvisor_10_50() { @@ -24,9 +24,8 @@ public class BaseAdvisor_10_50 extends BaseAdvisor50 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - return (lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url)); + // no globally ignored extensions here. + return false; } public boolean ignoreType(@Nonnull String path, diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_30.java index d4a399054..213f8b0f6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_30.java @@ -10,8 +10,6 @@ import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30; public class BaseAdvisor_14_30 extends BaseAdvisor30 { - private final List ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")); - public BaseAdvisor_14_30() { } @@ -22,6 +20,7 @@ public class BaseAdvisor_14_30 extends BaseAdvisor30 { - final List conformanceIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - private final List ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")); private final List> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class)); public BaseAdvisor_14_40() { @@ -27,13 +25,8 @@ public class BaseAdvisor_14_40 extends BaseAdvisor40 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - if ((lastPath.equals("Conformance")) && (conformanceIgnoredUrls.contains(url))) { - return true; - } else { - return this.ignoredUrls.contains(url); - } + // no globally ignored extensions here. + return false; } public boolean ignoreType(@Nonnull String path, @Nonnull Type type) { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_50.java index c0a0d2886..811902a54 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_14_50.java @@ -11,8 +11,6 @@ import org.hl7.fhir.exceptions.FHIRException; public class BaseAdvisor_14_50 extends BaseAdvisor50 { - final List capabilityStatementIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - public BaseAdvisor_14_50() { } @@ -23,8 +21,7 @@ public class BaseAdvisor_14_50 extends BaseAdvisor50 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - return (lastPath.equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url)); + // no globally ignored extensions here. + return false; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_40.java index 315cea928..e5594879f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_40.java @@ -10,11 +10,6 @@ import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor40; import org.hl7.fhir.exceptions.FHIRException; public class BaseAdvisor_30_40 extends BaseAdvisor40 { - - final List capabilityStatementIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"); - - final List immunizationIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven"); - public BaseAdvisor_30_40() { } @@ -25,13 +20,7 @@ public class BaseAdvisor_30_40 extends BaseAdvisor40 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - if (lastPath.equals("CapabilityStatement")) { - return capabilityStatementIgnoredUrls.contains(url); - } else if (lastPath.equals("Immunization")) { - return immunizationIgnoredUrls.contains(url); - } + // no globally ignored extensions here. return false; } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_50.java index 41d8a64c6..a0ead0adb 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_30_50.java @@ -11,10 +11,6 @@ import org.hl7.fhir.exceptions.FHIRException; public class BaseAdvisor_30_50 extends BaseAdvisor50 { - final List valueSetIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/StructureDefinition/valueset-extensible"); - final List capabilityStatementIgnoredUrls = Arrays.asList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown", - "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile"); - public BaseAdvisor_30_50() { } @@ -25,15 +21,8 @@ public class BaseAdvisor_30_50 extends BaseAdvisor50 paths = Arrays.asList(path.split(",")); - final String lastPath = paths.get(paths.size() - 1); - if ((lastPath.equals("ValueSet")) && (valueSetIgnoredUrls.contains(url))) { - return true; - } else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) { - return true; - } else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) { - return true; - } else - return (lastPath.equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url)); + // no globally ignored extensions here. + return false; } + } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_40_50.java index efd01620b..5c2581f30 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/advisors/impl/BaseAdvisor_40_50.java @@ -34,11 +34,8 @@ public class BaseAdvisor_40_50 extends BaseAdvisor50 !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu3.model.Extension convertedExtension = new org.hl7.fhir.dstu3.model.Extension(); @@ -39,10 +39,10 @@ public class Element10_30 { public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2.model.Extension convertedExtension = new org.hl7.fhir.dstu2.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/resources10_30/Resource10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/resources10_30/Resource10_30.java index 829fd6281..63572dc2d 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/resources10_30/Resource10_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/resources10_30/Resource10_30.java @@ -6,6 +6,8 @@ import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Meta10_30; import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Narrative10_30; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource10_30 { public final BaseAdvisor_10_30 advisor; @@ -14,26 +16,34 @@ public class Resource10_30 { this.advisor = advisor; } - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, - org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2.model.DomainResource src, + org.hl7.fhir.dstu3.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); tgt.setText(Narrative10_30.convertNarrative(src.getText())); - for (org.hl7.fhir.dstu2.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu2.model.Extension t : src.getExtension()) - tgt.addExtension(Extension10_30.convertExtension(t)); - for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(Extension10_30.convertExtension(t)); + for (org.hl7.fhir.dstu2.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource)); + for (org.hl7.fhir.dstu2.model.Extension extension : src.getExtension()) + if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) + tgt.addExtension(Extension10_30.convertExtension(extension)); + + for (org.hl7.fhir.dstu2.model.Extension modifierExtension : src.getModifierExtension()) + tgt.addModifierExtension(Extension10_30.convertExtension(modifierExtension)); } - public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, - org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu3.model.DomainResource src, + org.hl7.fhir.dstu2.model.DomainResource tgt, + String ... extensionUrlsToIgnore + ) throws FHIRException { copyResource(src, tgt); tgt.setText(Narrative10_30.convertNarrative(src.getText())); - for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) - tgt.addExtension(Extension10_30.convertExtension(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(Extension10_30.convertExtension(t)); + for (org.hl7.fhir.dstu3.model.Resource containedResource : src.getContained()) tgt.addContained(convertResource(containedResource)); + for (org.hl7.fhir.dstu3.model.Extension extension : src.getExtension()) + if (!Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) + tgt.addExtension(Extension10_30.convertExtension(extension)); + for (org.hl7.fhir.dstu3.model.Extension modifierExtension : src.getModifierExtension()) + tgt.addModifierExtension(Extension10_30.convertExtension(modifierExtension)); } public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/VersionConvertor_10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/VersionConvertor_10_40.java index b0d396cd7..81c02c936 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/VersionConvertor_10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/VersionConvertor_10_40.java @@ -143,32 +143,36 @@ public class VersionConvertor_10_40 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2.model.DomainResource src, - @Nonnull org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu2.model.DomainResource src, + @Nonnull org.hl7.fhir.r4.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r4.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } public void copyElement(@Nonnull org.hl7.fhir.dstu2.model.Element src, @Nonnull org.hl7.fhir.r4.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), var); + String... ignoredExtensionUrls) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), ignoredExtensionUrls); } public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src, @Nonnull org.hl7.fhir.dstu2.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), var); + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), extensionUrlsToIgnore); } public void copyElement(@Nonnull org.hl7.fhir.r4.model.DomainResource src, @Nonnull org.hl7.fhir.dstu2.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), var); + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_40.INSTANCE.path(), extensionUrlsToIgnore); } public void copyBackboneElement(@Nonnull org.hl7.fhir.r4.model.BackboneElement src, diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/BackboneElement10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/BackboneElement10_40.java index 0fbc37574..9f1aa4e06 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/BackboneElement10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/BackboneElement10_40.java @@ -4,19 +4,21 @@ import org.hl7.fhir.convertors.context.ConversionContext10_40; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement10_40 { - static public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, - org.hl7.fhir.r4.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.dstu2.model.BackboneElement src, + org.hl7.fhir.r4.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension10_40.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, - org.hl7.fhir.dstu2.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.r4.model.BackboneElement src, + org.hl7.fhir.dstu2.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension10_40.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/Element10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/Element10_40.java index 6263e05e8..4e26c90f9 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/Element10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/datatypes10_40/Element10_40.java @@ -20,10 +20,10 @@ public class Element10_40 { public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r4.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r4.model.Extension convertedExtension = new org.hl7.fhir.r4.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Conformance10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Conformance10_40.java index 424e9fa31..1f244df69 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Conformance10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Conformance10_40.java @@ -21,6 +21,11 @@ import org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction; public class Conformance10_40 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL + }; static public org.hl7.fhir.dstu2.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -69,7 +74,7 @@ public class Conformance10_40 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); - ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); + ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrlElement()) tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement())); if (src.hasVersionElement()) @@ -100,8 +105,8 @@ public class Conformance10_40 { tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); if (src.hasFhirVersion()) tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) @@ -152,7 +157,7 @@ public class Conformance10_40 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Resource10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Resource10_40.java index d6e6dfeb2..b35793e67 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Resource10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/resources10_40/Resource10_40.java @@ -8,6 +8,8 @@ import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Narrative10_40; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.Extension; +import java.util.Arrays; + public class Resource10_40 { public final BaseAdvisor_10_40 advisor; @@ -272,20 +274,22 @@ public class Resource10_40 { } } - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, - org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2.model.DomainResource src, + org.hl7.fhir.r4.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative10_40.convertNarrative(src.getText())); src.getContained().stream() .map(this::convertResource) .forEach(tgt::addContained); - src.getExtension().forEach(ext -> { - if (advisor.useAdvisorForExtension(ConversionContext10_40.INSTANCE.path(), ext)) { + src.getExtension().forEach(extension -> { + if (advisor.useAdvisorForExtension(ConversionContext10_40.INSTANCE.path(), extension)) { Extension convertExtension = new Extension(); - advisor.handleExtension(ConversionContext10_40.INSTANCE.path(), ext, convertExtension); + advisor.handleExtension(ConversionContext10_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext10_40.INSTANCE.path(), ext)) { - tgt.addExtension(Extension10_40.convertExtension(ext)); + } else if (!advisor.ignoreExtension(ConversionContext10_40.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { + tgt.addExtension(Extension10_40.convertExtension(extension)); } }); src.getModifierExtension().stream() @@ -294,8 +298,10 @@ public class Resource10_40 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, - org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.r4.model.DomainResource src, + org.hl7.fhir.dstu2.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative10_40.convertNarrative(src.getText())); src.getContained().stream() @@ -306,7 +312,7 @@ public class Resource10_40 { org.hl7.fhir.dstu2.model.Extension convertExtension = new org.hl7.fhir.dstu2.model.Extension(); advisor.handleExtension(ConversionContext10_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext10_40.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext10_40.INSTANCE.path(), extension)&& !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension10_40.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/VersionConvertor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/VersionConvertor_10_50.java index 21663a2e5..ad0b3814c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/VersionConvertor_10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/VersionConvertor_10_50.java @@ -144,43 +144,50 @@ public class VersionConvertor_10_50 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2.model.DomainResource src, - @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu2.model.DomainResource src, + @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } public void copyElement(@Nonnull org.hl7.fhir.dstu2.model.Element src, @Nonnull org.hl7.fhir.r5.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), var); + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), extensionUrlsToIgnore); } public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src, @Nonnull org.hl7.fhir.dstu2.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), var); + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext10_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r5.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu2.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r5.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu2.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu2.model.BackboneElement src, - @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu2.model.BackboneElement src, + @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/BackboneElement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/BackboneElement10_50.java index fc5b83be5..bbc4ee939 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/BackboneElement10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/BackboneElement10_50.java @@ -4,19 +4,21 @@ import org.hl7.fhir.convertors.context.ConversionContext10_50; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement10_50 { - static public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, - org.hl7.fhir.r5.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.dstu2.model.BackboneElement src, + org.hl7.fhir.r5.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension10_50.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, - org.hl7.fhir.dstu2.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.r5.model.BackboneElement src, + org.hl7.fhir.dstu2.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension10_50.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/Element10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/Element10_50.java index 30d76b29d..e89d5b0c4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/Element10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/Element10_50.java @@ -20,10 +20,10 @@ public class Element10_50 { public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r5.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r5.model.Extension convertedExtension = new org.hl7.fhir.r5.model.Extension(); @@ -38,10 +38,10 @@ public class Element10_50 { public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2.model.Extension convertedExtension = new org.hl7.fhir.dstu2.model.Extension(); @@ -56,10 +56,10 @@ public class Element10_50 { public void copyElement(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2.model.Extension convertedExtension = new org.hl7.fhir.dstu2.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Conformance10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Conformance10_50.java index 3660c1ccb..f313c496f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Conformance10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Conformance10_50.java @@ -20,6 +20,12 @@ import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction; public class Conformance10_50 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL + }; + static public org.hl7.fhir.dstu2.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -72,7 +78,7 @@ public class Conformance10_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); - ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt); + ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrlElement()) tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement())); if (src.hasVersionElement()) @@ -103,8 +109,8 @@ public class Conformance10_50 { tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); if (src.hasFhirVersion()) tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) @@ -155,7 +161,7 @@ public class Conformance10_50 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Resource10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Resource10_50.java index 1be52c7cf..ce6df2961 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Resource10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/resources10_50/Resource10_50.java @@ -8,6 +8,8 @@ import org.hl7.fhir.convertors.conv10_50.datatypes10_50.Narrative10_50; import org.hl7.fhir.dstu2.model.Extension; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource10_50 { public final BaseAdvisor_10_50 advisor; @@ -264,7 +266,10 @@ public class Resource10_50 { } } - public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2.model.DomainResource src, + org.hl7.fhir.r5.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative10_50.convertNarrative(src.getText())); src.getContained().stream() @@ -275,7 +280,7 @@ public class Resource10_50 { org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); advisor.handleExtension(ConversionContext10_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext10_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext10_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension10_50.convertExtension(extension)); } }); @@ -285,7 +290,10 @@ public class Resource10_50 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.r5.model.DomainResource src, + org.hl7.fhir.dstu2.model.DomainResource tgt, + String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative10_50.convertNarrative(src.getText())); src.getContained().stream() @@ -296,7 +304,7 @@ public class Resource10_50 { Extension convertExtension = new Extension(); advisor.handleExtension(ConversionContext10_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext10_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext10_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension10_50.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/VersionConvertor_14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/VersionConvertor_14_30.java index 64cec76b3..ea976f060 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/VersionConvertor_14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/VersionConvertor_14_30.java @@ -113,37 +113,45 @@ public class VersionConvertor_14_30 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu3.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu3.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu2016may.model.Element src, - @Nonnull org.hl7.fhir.dstu3.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_30.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu2016may.model.Element src, + @Nonnull org.hl7.fhir.dstu3.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_30.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu3.model.Element src, - @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_30.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu3.model.Element src, + @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_30.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/BackboneElement14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/BackboneElement14_30.java index 0adbc503e..6de09b207 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/BackboneElement14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/BackboneElement14_30.java @@ -4,19 +4,21 @@ import org.hl7.fhir.convertors.context.ConversionContext14_30; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement14_30 { - static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, - org.hl7.fhir.dstu3.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.dstu2016may.model.BackboneElement src, + org.hl7.fhir.dstu3.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_30.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, - org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.dstu3.model.BackboneElement src, + org.hl7.fhir.dstu2016may.model.BackboneElement tgt, + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_30.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Element14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Element14_30.java index 62d2bfd90..cd5b9d95a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Element14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/datatypes14_30/Element14_30.java @@ -21,10 +21,10 @@ public class Element14_30 { public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) @@ -42,10 +42,10 @@ public class Element14_30 { public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2016may.model.Extension convertedExtension = new org.hl7.fhir.dstu2016may.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/resources14_30/Resource14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/resources14_30/Resource14_30.java index 2b00484cb..e32ee85c1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/resources14_30/Resource14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/resources14_30/Resource14_30.java @@ -7,6 +7,8 @@ import org.hl7.fhir.convertors.conv14_30.datatypes14_30.Meta14_30; import org.hl7.fhir.convertors.conv14_30.datatypes14_30.Narrative14_30; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource14_30 { public final BaseAdvisor_14_30 advisor; @@ -115,8 +117,10 @@ public class Resource14_30 { } } - public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, - org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2016may.model.DomainResource src, + org.hl7.fhir.dstu3.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_30.convertNarrative(src.getText())); src.getContained().stream() @@ -127,7 +131,7 @@ public class Resource14_30 { org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension(); advisor.handleExtension(ConversionContext14_30.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_30.convertExtension(extension)); } }); @@ -137,8 +141,11 @@ public class Resource14_30 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, - org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu3.model.DomainResource src, + org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_30.convertNarrative(src.getText())); src.getContained().stream() @@ -149,7 +156,7 @@ public class Resource14_30 { org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension(); advisor.handleExtension(ConversionContext14_30.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_30.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_30.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/VersionConvertor_14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/VersionConvertor_14_40.java index eb0d50d5c..02e99095e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/VersionConvertor_14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/VersionConvertor_14_40.java @@ -137,37 +137,45 @@ public class VersionConvertor_14_40 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, - @Nonnull org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, + @Nonnull org.hl7.fhir.r4.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r4.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu2016may.model.Element src, - @Nonnull org.hl7.fhir.r4.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_40.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu2016may.model.Element src, + @Nonnull org.hl7.fhir.r4.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_40.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src, - @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_40.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r4.model.Element src, + @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_40.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r4.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r4.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, - @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, + @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/BackboneElement14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/BackboneElement14_40.java index 480120e1d..d05e2c062 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/BackboneElement14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/BackboneElement14_40.java @@ -6,8 +6,8 @@ import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement14_40 { static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt, var); + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_40.convertExtension(e)); } @@ -15,8 +15,8 @@ public class BackboneElement14_40 { static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String ... var) throws FHIRException { - ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt, var); + String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_40.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Element14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Element14_40.java index 998bb754f..bbd811ebc 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Element14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/datatypes14_40/Element14_40.java @@ -20,10 +20,10 @@ public class Element14_40 { public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r4.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r4.model.Extension convertedExtension = new org.hl7.fhir.r4.model.Extension(); @@ -38,10 +38,10 @@ public class Element14_40 { public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2016may.model.Extension convertedExtension = new org.hl7.fhir.dstu2016may.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Conformance14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Conformance14_40.java index 29ac51302..12734273f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Conformance14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Conformance14_40.java @@ -19,6 +19,12 @@ import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResource public class Conformance14_40 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL + }; + static public org.hl7.fhir.r4.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Enumeration src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -67,7 +73,7 @@ public class Conformance14_40 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt); + ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrl()) tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -102,8 +108,8 @@ public class Conformance14_40 { if (src.hasImplementation()) tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) @@ -159,7 +165,7 @@ public class Conformance14_40 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Resource14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Resource14_40.java index 08477d722..6d3bb6b94 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Resource14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/resources14_40/Resource14_40.java @@ -7,6 +7,8 @@ import org.hl7.fhir.convertors.conv14_40.datatypes14_40.Meta14_40; import org.hl7.fhir.convertors.conv14_40.datatypes14_40.Narrative14_40; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource14_40 { public final BaseAdvisor_14_40 advisor; @@ -113,8 +115,10 @@ public class Resource14_40 { } } - public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, - org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2016may.model.DomainResource src, + org.hl7.fhir.r4.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_40.convertNarrative(src.getText())); src.getContained().stream() @@ -125,7 +129,7 @@ public class Resource14_40 { org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension(); advisor.handleExtension(ConversionContext14_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_40.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_40.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_40.convertExtension(extension)); } }); @@ -135,8 +139,10 @@ public class Resource14_40 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, - org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.r4.model.DomainResource src, + org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_40.convertNarrative(src.getText())); src.getContained().stream() @@ -147,7 +153,7 @@ public class Resource14_40 { org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension(); advisor.handleExtension(ConversionContext14_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_40.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_40.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_40.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/VersionConvertor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/VersionConvertor_14_50.java index 0718ec831..83290b301 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/VersionConvertor_14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/VersionConvertor_14_50.java @@ -129,37 +129,45 @@ public class VersionConvertor_14_50 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, - @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src, + @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu2016may.model.Element src, - @Nonnull org.hl7.fhir.r5.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu2016may.model.Element src, + @Nonnull org.hl7.fhir.r5.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src, - @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r5.model.Element src, + @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r5.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r5.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, - @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu2016may.model.BackboneElement src, + @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/BackboneElement14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/BackboneElement14_50.java index 2d1ad0f45..e7bf94f7f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/BackboneElement14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/BackboneElement14_50.java @@ -4,19 +4,21 @@ import org.hl7.fhir.convertors.context.ConversionContext14_50; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement14_50 { - static public void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, - org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.dstu2016may.model.BackboneElement src, + org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_50.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, - org.hl7.fhir.dstu2016may.model.BackboneElement tgt, - String... var) throws FHIRException { - ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, var); + static public void copyBackboneElement( + org.hl7.fhir.r5.model.BackboneElement src, + org.hl7.fhir.dstu2016may.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension14_50.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/Element14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/Element14_50.java index a0c7a2576..145b94718 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/Element14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/datatypes14_50/Element14_50.java @@ -21,10 +21,10 @@ public class Element14_50 { public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r5.model.Extension convertedExtension = new org.hl7.fhir.r5.model.Extension(); @@ -39,10 +39,10 @@ public class Element14_50 { public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu2016may.model.Extension convertedExtension = new org.hl7.fhir.dstu2016may.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Conformance14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Conformance14_50.java index c98e72650..afe87693e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Conformance14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Conformance14_50.java @@ -18,6 +18,12 @@ import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResource public class Conformance14_50 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL + }; + static public org.hl7.fhir.dstu2016may.model.Enumeration convertConditionalDeleteStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -103,7 +109,7 @@ public class Conformance14_50 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t)); @@ -118,7 +124,7 @@ public class Conformance14_50 { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt); + ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrl()) tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -153,8 +159,8 @@ public class Conformance14_50 { if (src.hasImplementation()) tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Resource14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Resource14_50.java index c84d0d33b..d0cb14f8a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Resource14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/resources14_50/Resource14_50.java @@ -7,6 +7,8 @@ import org.hl7.fhir.convertors.conv14_50.datatypes14_50.Meta14_50; import org.hl7.fhir.convertors.conv14_50.datatypes14_50.Narrative14_50; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource14_50 { public final BaseAdvisor_14_50 advisor; @@ -113,8 +115,10 @@ public class Resource14_50 { } } - public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, - org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.dstu2016may.model.DomainResource src, + org.hl7.fhir.r5.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_50.convertNarrative(src.getText())); src.getContained().stream() @@ -125,7 +129,7 @@ public class Resource14_50 { org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); advisor.handleExtension(ConversionContext14_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_50.convertExtension(extension)); } }); @@ -135,8 +139,10 @@ public class Resource14_50 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, - org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource( + org.hl7.fhir.r5.model.DomainResource src, + org.hl7.fhir.dstu2016may.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative14_50.convertNarrative(src.getText())); src.getContained().stream() @@ -147,7 +153,7 @@ public class Resource14_50 { org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension(); advisor.handleExtension(ConversionContext14_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext14_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext14_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension14_50.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/VersionConvertor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/VersionConvertor_30_40.java index 9d73a678f..1ef82420b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/VersionConvertor_30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/VersionConvertor_30_40.java @@ -133,36 +133,42 @@ public class VersionConvertor_30_40 { } public void copyDomainResource(@Nonnull org.hl7.fhir.dstu3.model.DomainResource src, - @Nonnull org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + @Nonnull org.hl7.fhir.r4.model.DomainResource tgt, String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r4.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu3.model.Element src, - @Nonnull org.hl7.fhir.r4.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext30_40.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu3.model.Element src, + @Nonnull org.hl7.fhir.r4.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext30_40.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src, - @Nonnull org.hl7.fhir.dstu3.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext30_40.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r4.model.Element src, + @Nonnull org.hl7.fhir.dstu3.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext30_40.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r4.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r4.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, - @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, + @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/BackboneElement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/BackboneElement30_40.java index cce1ac0eb..6cd69b570 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/BackboneElement30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/BackboneElement30_40.java @@ -4,15 +4,15 @@ import org.hl7.fhir.convertors.context.ConversionContext30_40; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement30_40 { - static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt, String... var) throws FHIRException { - ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt, var); + static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt, String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension30_40.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt, String... var) throws FHIRException { - ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt, var); + static public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt, String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension30_40.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/Element30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/Element30_40.java index 5f00af98a..813ac6d11 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/Element30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/datatypes30_40/Element30_40.java @@ -13,17 +13,17 @@ public class Element30_40 { this.advisor = advisor; } - public boolean isExemptExtension(String url, String[] extensionsToIgnore) { - return Arrays.asList(extensionsToIgnore).contains(url); + public boolean isExemptExtension(String url, String[] extensionUrlsToIgnore) { + return Arrays.asList(extensionUrlsToIgnore).contains(url); } public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r4.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r4.model.Extension convertedExtension = new org.hl7.fhir.r4.model.Extension(); @@ -38,10 +38,10 @@ public class Element30_40 { public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu3.model.Extension convertedExtension = new org.hl7.fhir.dstu3.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java index 025ebaccb..083e81ba6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java @@ -20,11 +20,17 @@ import org.hl7.fhir.exceptions.FHIRException; public class CapabilityStatement30_40 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL + }; + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { if (src == null) return null; org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); + ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrl()) tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -62,8 +68,8 @@ public class CapabilityStatement30_40 { tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); if (src.hasFhirVersion()) tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.r4.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); for (org.hl7.fhir.r4.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); @@ -128,7 +134,7 @@ public class CapabilityStatement30_40 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Immunization30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Immunization30_40.java index 51aa26e0d..fa82874aa 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Immunization30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Immunization30_40.java @@ -20,6 +20,10 @@ public class Immunization30_40 { public static final String NOT_GIVEN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven"; + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + NOT_GIVEN_EXTENSION_URL + }; + public static org.hl7.fhir.r4.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { if (src == null) return null; @@ -82,7 +86,8 @@ public class Immunization30_40 { if (src == null) return null; org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); - ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); + + ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); if (src.hasStatus()) { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Resource30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Resource30_40.java index 8eab2452e..36e962454 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Resource30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/Resource30_40.java @@ -7,6 +7,8 @@ import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Meta30_40; import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Narrative30_40; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource30_40 { public final BaseAdvisor_30_40 advisor; @@ -384,7 +386,8 @@ public class Resource30_40 { } public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, - org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + org.hl7.fhir.r4.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative30_40.convertNarrative(src.getText())); src.getContained().stream() @@ -396,7 +399,7 @@ public class Resource30_40 { org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension(); advisor.handleExtension(ConversionContext30_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext30_40.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext30_40.INSTANCE.path(), extension)&& !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension30_40.convertExtension(extension)); } }); @@ -407,7 +410,8 @@ public class Resource30_40 { } public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, - org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + org.hl7.fhir.dstu3.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative30_40.convertNarrative(src.getText())); src.getContained().stream() @@ -418,7 +422,7 @@ public class Resource30_40 { org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension(); advisor.handleExtension(ConversionContext30_40.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext30_40.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext30_40.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension30_40.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Resource30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Resource30_50.java index 2135adfa8..9b1a5cb47 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Resource30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Resource30_50.java @@ -91,6 +91,8 @@ import org.hl7.fhir.convertors.conv30_50.resources30_50.ValueSet30_50; import org.hl7.fhir.dstu3.model.Basic; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource30_50 { public final BaseAdvisor_30_50 advisor; @@ -451,7 +453,7 @@ public class Resource30_50 { } public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, - org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + org.hl7.fhir.r5.model.DomainResource tgt, String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative30_50.convertNarrative(src.getText())); src.getContained().stream() @@ -462,7 +464,7 @@ public class Resource30_50 { org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); advisor.handleExtension(ConversionContext30_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext30_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext30_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension30_50.convertExtension(extension)); } }); @@ -473,7 +475,7 @@ public class Resource30_50 { } public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, - org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative30_50.convertNarrative(src.getText())); src.getContained().stream() @@ -484,7 +486,7 @@ public class Resource30_50 { org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension(); advisor.handleExtension(ConversionContext30_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext30_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext30_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension30_50.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/VersionConvertor_30_50.java index 3ea40bead..39051261c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/VersionConvertor_30_50.java @@ -130,37 +130,45 @@ public class VersionConvertor_30_50 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.dstu3.model.DomainResource src, - @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.dstu3.model.DomainResource src, + @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.dstu3.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.dstu3.model.Element src, - @Nonnull org.hl7.fhir.r5.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext30_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.dstu3.model.Element src, + @Nonnull org.hl7.fhir.r5.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext30_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src, - @Nonnull org.hl7.fhir.dstu3.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext30_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r5.model.Element src, + @Nonnull org.hl7.fhir.dstu3.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext30_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r5.model.BackboneElement src, - @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r5.model.BackboneElement src, + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, - @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.dstu3.model.BackboneElement src, + @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/BackboneElement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/BackboneElement30_50.java index 40ff12ca6..4e6bd297d 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/BackboneElement30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/BackboneElement30_50.java @@ -4,15 +4,15 @@ import org.hl7.fhir.convertors.context.ConversionContext30_50; import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement30_50 { - static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... var) throws FHIRException { - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src,tgt, var); + static public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src,tgt, extensionUrlsToIgnore); for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension30_50.convertExtension(e)); } } - static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt, String ... var) throws FHIRException { - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt, var); + static public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt, String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension30_50.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Element30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Element30_50.java index 6dcc899cf..a1f03db44 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Element30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/datatypes30_50/Element30_50.java @@ -13,17 +13,17 @@ public class Element30_50 { this.advisor = advisor; } - public boolean isExemptExtension(String url, String[] extensionsToIgnore) { - return Arrays.asList(extensionsToIgnore).contains(url); + public boolean isExemptExtension(String url, String[] extensionUrlsToIgnore) { + return Arrays.asList(extensionUrlsToIgnore).contains(url); } public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r5.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r5.model.Extension convertedExtension = new org.hl7.fhir.r5.model.Extension(); @@ -38,10 +38,10 @@ public class Element30_50 { public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.dstu3.model.Extension convertedExtension = new org.hl7.fhir.dstu3.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ActorDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ActorDefinition30_50.java index f24b39c95..93a8fc0ab 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ActorDefinition30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ActorDefinition30_50.java @@ -50,6 +50,50 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class ActorDefinition30_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel"; + public static final String TYPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type"; + public static final String DOCUMENTATION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation"; + public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference"; + public static final String CAPABILITIES_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + TYPE_EXTENSION_URL, + DOCUMENTATION_EXTENSION_URL, + REFERENCE_EXTENSION_URL, + CAPABILITIES_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL + }; + public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { if (src == null) return null; @@ -57,69 +101,70 @@ public class ActorDefinition30_50 { throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition"); } org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition(); - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); + + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url")) { - tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version")) { - tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name")) { - tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title")) { - tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental")) { - tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date")) { - tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher")) { - tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail30_50.convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description")) { - tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext30_50.convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose")) { - tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright")) { - tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel")) { - tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type")) { - tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type").getValue().primitiveValue())); + if (src.hasExtension(TYPE_EXTENSION_URL)) { + tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl(TYPE_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation")) { - tgt.setDocumentationElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation").getValue())); + if (src.hasExtension(DOCUMENTATION_EXTENSION_URL)) { + tgt.setDocumentationElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(DOCUMENTATION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) { tgt.getReference().add(Uri30_50.convertUrl((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities")) { - tgt.setCapabilitiesElement(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities").getValue())); + if (src.hasExtension(CAPABILITIES_EXTENSION_URL)) { + tgt.setCapabilitiesElement(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl(CAPABILITIES_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); } return tgt; @@ -135,64 +180,64 @@ public class ActorDefinition30_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url", Uri30_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri30_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version", String30_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String30_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name", String30_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String30_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title", String30_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String30_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status", new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental", Boolean30_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean30_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date", DateTime30_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime30_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher", String30_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String30_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact", ContactDetail30_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail30_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description", MarkDown30_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext", UsageContext30_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext30_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction", CodeableConcept30_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept30_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose", MarkDown30_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright", MarkDown30_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel", String30_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String30_50.convertString(src.getCopyrightLabelElement())); } if (src.hasType()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type", new org.hl7.fhir.dstu3.model.CodeType(src.getType().toCode())); + tgt.addExtension(TYPE_EXTENSION_URL, new org.hl7.fhir.dstu3.model.CodeType(src.getType().toCode())); } if (src.hasDocumentation()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation", MarkDown30_50.convertMarkdown(src.getDocumentationElement())); + tgt.addExtension(DOCUMENTATION_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getDocumentationElement())); } for (UrlType ref : src.getReference()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference", Uri30_50.convertUrl(ref)); + tgt.addExtension(REFERENCE_EXTENSION_URL, Uri30_50.convertUrl(ref)); } if (src.hasCapabilities()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities", Uri30_50.convertCanonical(src.getCapabilitiesElement())); + tgt.addExtension(CAPABILITIES_EXTENSION_URL, Uri30_50.convertCanonical(src.getCapabilitiesElement())); } for (CanonicalType ct : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom", Uri30_50.convertCanonical(ct)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Uri30_50.convertCanonical(ct)); } return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java index 19ea47cde..2f8e62bd2 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java @@ -20,6 +20,14 @@ import org.hl7.fhir.exceptions.FHIRException; public class CapabilityStatement30_50 { + public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; + public static final String PROFILE_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + ACCEPT_UNKNOWN_EXTENSION_URL, + PROFILE_EXTENSION_URL + }; + public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { if (src == null) return null; @@ -63,14 +71,14 @@ public class CapabilityStatement30_50 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(fixCode(src.getFhirVersion()))); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertCapabilityStatementRestComponent(t)); for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", Reference30_50.convertReference(t)); + tgt.addExtension(PROFILE_EXTENSION_URL, Reference30_50.convertReference(t)); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) @@ -90,7 +98,7 @@ public class CapabilityStatement30_50 { if (src == null) return null; org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrl()) tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -128,8 +136,8 @@ public class CapabilityStatement30_50 { tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); if (src.hasFhirVersion()) tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) - tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); + if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) + tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.r5.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); for (org.hl7.fhir.r5.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); @@ -138,7 +146,7 @@ public class CapabilityStatement30_50 { for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(Reference30_50.convertCanonicalToReference(t)); for (org.hl7.fhir.r5.model.Extension ext : src.getExtension()) { - if ("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile".equals(ext.getUrl())) { + if (PROFILE_EXTENSION_URL.equals(ext.getUrl())) { tgt.addProfile(Reference30_50.convertReference((org.hl7.fhir.r5.model.Reference) ext.getValue())); } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/Requirements30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/Requirements30_50.java index 4ca6663fe..020c478f6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/Requirements30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/Requirements30_50.java @@ -56,6 +56,45 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class Requirements30_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; + public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; + public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL, + ACTOR_EXTENSION_URL, + STATEMENT_EXTENSION_URL + }; public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { if (src == null) return null; @@ -63,63 +102,64 @@ public class Requirements30_50 { throw new FHIRException("Error in logic: this basic resource is not an Requirements"); } org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements(); - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); + + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) { - tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) { - tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) { - tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) { - tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) { - tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) { - tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) { - tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail30_50.convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) { - tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext30_50.convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) { - tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) { - tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) { - tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { tgt.getActor().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); } - for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) { + for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) { convertRequirementsStatement(ext, tgt.addStatement()); } return tgt; @@ -136,58 +176,58 @@ public class Requirements30_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri30_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri30_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String30_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String30_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String30_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String30_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String30_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String30_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean30_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean30_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime30_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime30_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String30_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String30_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail30_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail30_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown30_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext30_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext30_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept30_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept30_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown30_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown30_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String30_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String30_50.convertString(src.getCopyrightLabelElement())); } for (CanonicalType ref : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Uri30_50.convertCanonical(ref)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Uri30_50.convertCanonical(ref)); } for (CanonicalType ref : src.getActor()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Uri30_50.convertCanonical(ref)); + tgt.addExtension(ACTOR_EXTENSION_URL, Uri30_50.convertCanonical(ref)); } for (RequirementsStatementComponent ref : src.getStatement()) { - org.hl7.fhir.dstu3.model.Extension tgte = new org.hl7.fhir.dstu3.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"); + org.hl7.fhir.dstu3.model.Extension tgte = new org.hl7.fhir.dstu3.model.Extension(STATEMENT_EXTENSION_URL); tgt.addExtension(tgte); convertRequirementsStatement(ref, tgte); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ValueSet30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ValueSet30_50.java index 77d6622d1..19b42ae82 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ValueSet30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/ValueSet30_50.java @@ -19,6 +19,11 @@ import org.hl7.fhir.r5.model.BooleanType; public class ValueSet30_50 { + public static final String EXTENSIBLE_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/valueset-extensible"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + EXTENSIBLE_EXTENSION_URL + }; public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { if (src == null) return null; @@ -215,7 +220,7 @@ public class ValueSet30_50 { if (src.hasCopyright()) tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement())); if (src.hasExtensible()) - tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + tgt.addExtension(EXTENSIBLE_EXTENSION_URL, new BooleanType(src.getExtensible())); if (src.hasCompose()) tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); if (src.hasExpansion()) @@ -227,7 +232,7 @@ public class ValueSet30_50 { if (src == null) return null; org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); if (src.hasUrl()) tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) @@ -260,8 +265,8 @@ public class ValueSet30_50 { tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement())); if (src.hasCopyright()) tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement())); - if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) - tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + if (src.hasExtension(EXTENSIBLE_EXTENSION_URL)) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl(EXTENSIBLE_EXTENSION_URL).getValue()).booleanValue()); if (src.hasCompose()) tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); if (src.hasExpansion()) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VersionConvertor_40_50.java index c7db605b8..638226e83 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VersionConvertor_40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VersionConvertor_40_50.java @@ -107,37 +107,45 @@ public class VersionConvertor_40_50 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.r4.model.DomainResource src, - @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r4.model.DomainResource src, + @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.r4.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r4.model.Element src, - @Nonnull org.hl7.fhir.r5.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext40_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r4.model.Element src, + @Nonnull org.hl7.fhir.r5.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext40_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src, - @Nonnull org.hl7.fhir.r4.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext40_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r5.model.Element src, + @Nonnull org.hl7.fhir.r4.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext40_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r5.model.BackboneElement src, - @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r5.model.BackboneElement src, + @Nonnull org.hl7.fhir.r4.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r4.model.BackboneElement src, - @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r4.model.BackboneElement src, + @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/BackboneElement40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/BackboneElement40_50.java index 46c8dad3b..ccd124b48 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/BackboneElement40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/BackboneElement40_50.java @@ -5,15 +5,15 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Extension40 import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement40_50 { - public static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... var) throws FHIRException { - ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, var); + public static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension40_50.convertExtension(e)); } } - public static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt, String... var) throws FHIRException { - ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, var); + public static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt, String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension40_50.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Element40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Element40_50.java index 52bf28954..b53445972 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Element40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/datatypes40_50/Element40_50.java @@ -21,10 +21,10 @@ public class Element40_50 { public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.r5.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r5.model.Extension convertedExtension = new org.hl7.fhir.r5.model.Extension(); @@ -39,10 +39,10 @@ public class Element40_50 { public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.r4.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r4.model.Extension convertedExtension = new org.hl7.fhir.r4.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/ActorDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/ActorDefinition40_50.java index e869aab2b..7b79165e9 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/ActorDefinition40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/ActorDefinition40_50.java @@ -52,6 +52,50 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class ActorDefinition40_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel"; + public static final String TYPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type"; + public static final String DOCUMENTATION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation"; + public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference"; + public static final String CAPABILITIES_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + TYPE_EXTENSION_URL, + DOCUMENTATION_EXTENSION_URL, + REFERENCE_EXTENSION_URL, + CAPABILITIES_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL + }; + public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.r4.model.Basic src) throws FHIRException { if (src == null) return null; @@ -59,69 +103,70 @@ public class ActorDefinition40_50 { throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition"); } org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition(); - ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); + + ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url")) { - tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version")) { - tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name")) { - tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title")) { - tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental")) { - tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date")) { - tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher")) { - tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description")) { - tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose")) { - tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright")) { - tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel")) { - tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type")) { - tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type").getValue().primitiveValue())); + if (src.hasExtension(TYPE_EXTENSION_URL)) { + tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl(TYPE_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation")) { - tgt.setDocumentationElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation").getValue())); + if (src.hasExtension(DOCUMENTATION_EXTENSION_URL)) { + tgt.setDocumentationElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DOCUMENTATION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) { tgt.getReference().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities")) { - tgt.setCapabilitiesElement(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities").getValue())); + if (src.hasExtension(CAPABILITIES_EXTENSION_URL)) { + tgt.setCapabilitiesElement(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) src.getExtensionByUrl(CAPABILITIES_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); } return tgt; @@ -137,64 +182,64 @@ public class ActorDefinition40_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url", Uri40_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri40_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version", String40_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String40_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name", String40_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String40_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title", String40_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String40_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status", new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental", Boolean40_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean40_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date", DateTime40_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime40_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher", String40_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String40_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact", ContactDetail40_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail40_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description", MarkDown40_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext", UsageContext40_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext40_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction", CodeableConcept40_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose", MarkDown40_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright", MarkDown40_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel", String40_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String40_50.convertString(src.getCopyrightLabelElement())); } if (src.hasType()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type", new org.hl7.fhir.r4.model.CodeType(src.getType().toCode())); + tgt.addExtension(TYPE_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getType().toCode())); } if (src.hasDocumentation()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation", MarkDown40_50.convertMarkdown(src.getDocumentationElement())); + tgt.addExtension(DOCUMENTATION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDocumentationElement())); } for (UrlType ref : src.getReference()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference", Url40_50.convertUrl(ref)); + tgt.addExtension(REFERENCE_EXTENSION_URL, Url40_50.convertUrl(ref)); } if (src.hasCapabilities()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities", Canonical40_50.convertCanonical(src.getCapabilitiesElement())); + tgt.addExtension(CAPABILITIES_EXTENSION_URL, Canonical40_50.convertCanonical(src.getCapabilitiesElement())); } for (CanonicalType ct : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom", Canonical40_50.convertCanonical(ct)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical40_50.convertCanonical(ct)); } return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Requirements40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Requirements40_50.java index 38e8acb3c..65c434ab0 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Requirements40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Requirements40_50.java @@ -58,6 +58,46 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class Requirements40_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; + public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; + public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL, + ACTOR_EXTENSION_URL, + STATEMENT_EXTENSION_URL + }; + public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4.model.Basic src) throws FHIRException { if (src == null) return null; @@ -65,63 +105,64 @@ public class Requirements40_50 { throw new FHIRException("Error in logic: this basic resource is not an Requirements"); } org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements(); - ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); + + ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) { - tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) { - tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) { - tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) { - tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) { - tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) { - tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) { - tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) { - tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) { - tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) { - tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) { - tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); } - for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) { + for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) { convertRequirementsStatement(ext, tgt.addStatement()); } return tgt; @@ -138,58 +179,58 @@ public class Requirements40_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri40_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri40_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String40_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String40_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String40_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String40_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String40_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String40_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean40_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean40_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime40_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime40_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String40_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String40_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail40_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail40_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown40_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext40_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext40_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept40_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown40_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown40_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String40_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String40_50.convertString(src.getCopyrightLabelElement())); } for (CanonicalType ref : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Canonical40_50.convertCanonical(ref)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical40_50.convertCanonical(ref)); } for (CanonicalType ref : src.getActor()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Canonical40_50.convertCanonical(ref)); + tgt.addExtension(ACTOR_EXTENSION_URL, Canonical40_50.convertCanonical(ref)); } for (RequirementsStatementComponent ref : src.getStatement()) { - org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"); + org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(STATEMENT_EXTENSION_URL); tgt.addExtension(tgte); convertRequirementsStatement(ref, tgte); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Resource40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Resource40_50.java index 468fb4170..1df2482e6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Resource40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/resources40_50/Resource40_50.java @@ -11,6 +11,8 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Narrative40 import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.Basic; +import java.util.Arrays; + public class Resource40_50 { public final BaseAdvisor_40_50 advisor; @@ -525,7 +527,7 @@ public class Resource40_50 { } } - public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText())); src.getContained().stream() @@ -536,7 +538,7 @@ public class Resource40_50 { org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension40_50.convertExtension(extension)); } }); @@ -546,7 +548,7 @@ public class Resource40_50 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative40_50.convertNarrative(src.getText())); src.getContained().stream() @@ -557,7 +559,7 @@ public class Resource40_50 { org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension(); advisor.handleExtension(ConversionContext40_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext40_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension40_50.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/VersionConvertor_43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/VersionConvertor_43_50.java index d0dacff6c..c4d50132c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/VersionConvertor_43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/VersionConvertor_43_50.java @@ -107,37 +107,45 @@ public class VersionConvertor_43_50 { } } - public void copyDomainResource(@Nonnull org.hl7.fhir.r4b.model.DomainResource src, - @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r4b.model.DomainResource src, + @Nonnull org.hl7.fhir.r5.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src, - @Nonnull org.hl7.fhir.r4b.model.DomainResource tgt) throws FHIRException { - resourceConvertor.copyDomainResource(src, tgt); + public void copyDomainResource( + @Nonnull org.hl7.fhir.r5.model.DomainResource src, + @Nonnull org.hl7.fhir.r4b.model.DomainResource tgt, + String... extensionUrlsToIgnore) throws FHIRException { + resourceConvertor.copyDomainResource(src, tgt, extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r4b.model.Element src, - @Nonnull org.hl7.fhir.r5.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext43_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r4b.model.Element src, + @Nonnull org.hl7.fhir.r5.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext43_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src, - @Nonnull org.hl7.fhir.r4b.model.Element tgt, - String... var) throws FHIRException { - elementConvertor.copyElement(src, tgt, ConversionContext43_50.INSTANCE.path(), var); + public void copyElement( + @Nonnull org.hl7.fhir.r5.model.Element src, + @Nonnull org.hl7.fhir.r4b.model.Element tgt, + String... extensionUrlsToIgnore) throws FHIRException { + elementConvertor.copyElement(src, tgt, ConversionContext43_50.INSTANCE.path(), extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r5.model.BackboneElement src, - @Nonnull org.hl7.fhir.r4b.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r5.model.BackboneElement src, + @Nonnull org.hl7.fhir.r4b.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } - public void copyBackboneElement(@Nonnull org.hl7.fhir.r4b.model.BackboneElement src, - @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, - String... var) throws FHIRException { - backboneElementConvertor.copyBackboneElement(src, tgt, var); + public void copyBackboneElement( + @Nonnull org.hl7.fhir.r4b.model.BackboneElement src, + @Nonnull org.hl7.fhir.r5.model.BackboneElement tgt, + String... extensionUrlsToIgnore) throws FHIRException { + backboneElementConvertor.copyBackboneElement(src, tgt, extensionUrlsToIgnore); } } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/BackboneElement43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/BackboneElement43_50.java index cbef0e80d..24686761a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/BackboneElement43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/BackboneElement43_50.java @@ -5,15 +5,15 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Extension43 import org.hl7.fhir.exceptions.FHIRException; public class BackboneElement43_50 { - public static void copyBackboneElement(org.hl7.fhir.r4b.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... var) throws FHIRException { - ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, var); + public static void copyBackboneElement(org.hl7.fhir.r4b.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt, String ... extensionUrlsToIgnore) throws FHIRException { + ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r4b.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension43_50.convertExtension(e)); } } - public static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.r4b.model.BackboneElement tgt, String... var) throws FHIRException { - ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, var); + public static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.r4b.model.BackboneElement tgt, String... extensionUrlsToIgnore) throws FHIRException { + ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, extensionUrlsToIgnore); for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { tgt.addModifierExtension(Extension43_50.convertExtension(e)); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/Element43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/Element43_50.java index c7cd18342..2109751e4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/Element43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/datatypes43_50/Element43_50.java @@ -14,17 +14,17 @@ public class Element43_50 { this.advisor = advisor; } - public static boolean isExemptExtension(String url, String[] extensionsToIgnore) { - return Arrays.asList(extensionsToIgnore).contains(url); + public static boolean isExemptExtension(String url, String[] extensionUrlsToIgnore) { + return Arrays.asList(extensionUrlsToIgnore).contains(url); } public void copyElement(org.hl7.fhir.r4b.model.Element src, org.hl7.fhir.r5.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r5.model.Extension convertedExtension = new org.hl7.fhir.r5.model.Extension(); @@ -39,10 +39,10 @@ public class Element43_50 { public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.r4b.model.Element tgt, String path, - String... extensionsToIgnore) throws FHIRException { + String... extensionUrlsToIgnore) throws FHIRException { if (src.hasId()) tgt.setId(src.getId()); src.getExtension().stream() - .filter(e -> !isExemptExtension(e.getUrl(), extensionsToIgnore)) + .filter(e -> !isExemptExtension(e.getUrl(), extensionUrlsToIgnore)) .forEach(e -> { if (advisor.useAdvisorForExtension(path, e)) { org.hl7.fhir.r4b.model.Extension convertedExtension = new org.hl7.fhir.r4b.model.Extension(); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/ActorDefinition43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/ActorDefinition43_50.java index 7c59c17d5..1cdacc904 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/ActorDefinition43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/ActorDefinition43_50.java @@ -52,6 +52,50 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class ActorDefinition43_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel"; + public static final String TYPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type"; + public static final String DOCUMENTATION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation"; + public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference"; + public static final String CAPABILITIES_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + TYPE_EXTENSION_URL, + DOCUMENTATION_EXTENSION_URL, + REFERENCE_EXTENSION_URL, + CAPABILITIES_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL + }; + public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.r4b.model.Basic src) throws FHIRException { if (src == null) return null; @@ -59,69 +103,70 @@ public class ActorDefinition43_50 { throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition"); } org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition(); - ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); + + ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url")) { - tgt.setUrlElement(Uri43_50.convertUri((org.hl7.fhir.r4b.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri43_50.convertUri((org.hl7.fhir.r4b.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version")) { - tgt.setVersionElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name")) { - tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title")) { - tgt.setTitleElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental")) { - tgt.setExperimentalElement(Boolean43_50.convertBoolean((org.hl7.fhir.r4b.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean43_50.convertBoolean((org.hl7.fhir.r4b.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date")) { - tgt.setDateElement(DateTime43_50.convertDateTime((org.hl7.fhir.r4b.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime43_50.convertDateTime((org.hl7.fhir.r4b.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher")) { - tgt.setPublisherElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail43_50.convertContactDetail((org.hl7.fhir.r4b.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description")) { - tgt.setPublisherElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext43_50.convertUsageContext((org.hl7.fhir.r4b.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept((org.hl7.fhir.r4b.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose")) { - tgt.setPurposeElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright")) { - tgt.setCopyrightElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel")) { - tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type")) { - tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type").getValue().primitiveValue())); + if (src.hasExtension(TYPE_EXTENSION_URL)) { + tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl(TYPE_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation")) { - tgt.setDocumentationElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation").getValue())); + if (src.hasExtension(DOCUMENTATION_EXTENSION_URL)) { + tgt.setDocumentationElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(DOCUMENTATION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) { tgt.getReference().add(Url43_50.convertUrl((org.hl7.fhir.r4b.model.UrlType) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities")) { - tgt.setCapabilitiesElement(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities").getValue())); + if (src.hasExtension(CAPABILITIES_EXTENSION_URL)) { + tgt.setCapabilitiesElement(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) src.getExtensionByUrl(CAPABILITIES_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue())); } return tgt; @@ -137,64 +182,64 @@ public class ActorDefinition43_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url", Uri43_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri43_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version", String43_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String43_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name", String43_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String43_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title", String43_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String43_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status", new org.hl7.fhir.r4b.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4b.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental", Boolean43_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean43_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date", DateTime43_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime43_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher", String43_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String43_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact", ContactDetail43_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail43_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description", MarkDown43_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext", UsageContext43_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext43_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction", CodeableConcept43_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept43_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose", MarkDown43_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright", MarkDown43_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel", String43_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String43_50.convertString(src.getCopyrightLabelElement())); } if (src.hasType()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type", new org.hl7.fhir.r4b.model.CodeType(src.getType().toCode())); + tgt.addExtension(TYPE_EXTENSION_URL, new org.hl7.fhir.r4b.model.CodeType(src.getType().toCode())); } if (src.hasDocumentation()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation", MarkDown43_50.convertMarkdown(src.getDocumentationElement())); + tgt.addExtension(DOCUMENTATION_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getDocumentationElement())); } for (UrlType ref : src.getReference()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference", Url43_50.convertUrl(ref)); + tgt.addExtension(REFERENCE_EXTENSION_URL, Url43_50.convertUrl(ref)); } if (src.hasCapabilities()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities", Canonical43_50.convertCanonical(src.getCapabilitiesElement())); + tgt.addExtension(CAPABILITIES_EXTENSION_URL, Canonical43_50.convertCanonical(src.getCapabilitiesElement())); } for (CanonicalType ct : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom", Canonical43_50.convertCanonical(ct)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical43_50.convertCanonical(ct)); } return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Requirements43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Requirements43_50.java index c0e786565..c4aeb0dc9 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Requirements43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Requirements43_50.java @@ -58,6 +58,46 @@ import org.hl7.fhir.r5.model.UsageContext; // Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 public class Requirements43_50 { + public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url"; + public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version"; + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name"; + public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title"; + public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status"; + public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental"; + public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date"; + public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher"; + public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact"; + public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description"; + public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext"; + public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction"; + public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose"; + public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; + public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; + public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; + public static final String REQUIREMENTS_STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + URL_EXTENSION_URL, + VERSION_EXTENSION_URL, + NAME_EXTENSION_URL, + TITLE_EXTENSION_URL, + STATUS_EXTENSION_URL, + STATUS_EXTENSION_URL, + EXPERIMENTAL_EXTENSION_URL, + DATE_EXTENSION_URL, + PUBLISHER_EXTENSION_URL, + CONTACT_EXTENSION_URL, + DESCRIPTION_EXTENSION_URL, + USE_CONTEXT_EXTENSION_URL, + JURISDICTION_EXTENSION_URL, + PURPOSE_EXTENSION_URL, + COPYRIGHT_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL, + DERIVED_FROM_EXTENSION_URL, + ACTOR_EXTENSION_URL, + REQUIREMENTS_STATEMENT_EXTENSION_URL + }; public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4b.model.Basic src) throws FHIRException { if (src == null) return null; @@ -65,63 +105,63 @@ public class Requirements43_50 { throw new FHIRException("Error in logic: this basic resource is not an Requirements"); } org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements(); - ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); + ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) { - tgt.setUrlElement(Uri43_50.convertUri((org.hl7.fhir.r4b.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue())); + if (src.hasExtension(URL_EXTENSION_URL)) { + tgt.setUrlElement(Uri43_50.convertUri((org.hl7.fhir.r4b.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) { - tgt.setVersionElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue())); + if (src.hasExtension(VERSION_EXTENSION_URL)) { + tgt.setVersionElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) { - tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue())); + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) { - tgt.setTitleElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue())); + if (src.hasExtension(TITLE_EXTENSION_URL)) { + tgt.setTitleElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) { - tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue())); + if (src.hasExtension(STATUS_EXTENSION_URL)) { + tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) { - tgt.setExperimentalElement(Boolean43_50.convertBoolean((org.hl7.fhir.r4b.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue())); + if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { + tgt.setExperimentalElement(Boolean43_50.convertBoolean((org.hl7.fhir.r4b.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) { - tgt.setDateElement(DateTime43_50.convertDateTime((org.hl7.fhir.r4b.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue())); + if (src.hasExtension(DATE_EXTENSION_URL)) { + tgt.setDateElement(DateTime43_50.convertDateTime((org.hl7.fhir.r4b.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) { - tgt.setPublisherElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue())); + if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { + tgt.setPublisherElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { tgt.addContact(ContactDetail43_50.convertContactDetail((org.hl7.fhir.r4b.model.ContactDetail) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) { - tgt.setPublisherElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue())); + if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { + tgt.setPublisherElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { tgt.addUseContext(UsageContext43_50.convertUsageContext((org.hl7.fhir.r4b.model.UsageContext) ext.getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept((org.hl7.fhir.r4b.model.CodeableConcept) ext.getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) { - tgt.setPurposeElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue())); + if (src.hasExtension(PURPOSE_EXTENSION_URL)) { + tgt.setPurposeElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) { - tgt.setCopyrightElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue())); + if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { + tgt.setCopyrightElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) { - tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { tgt.getDerivedFrom().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { tgt.getActor().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue())); } - for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) { + for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(REQUIREMENTS_STATEMENT_EXTENSION_URL)) { convertRequirementsStatement(ext, tgt.addStatement()); } return tgt; @@ -138,58 +178,58 @@ public class Requirements43_50 { for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); if (src.hasUrl()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri43_50.convertUri(src.getUrlElement())); + tgt.addExtension(URL_EXTENSION_URL, Uri43_50.convertUri(src.getUrlElement())); } if (src.hasVersion()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String43_50.convertString(src.getVersionElement())); + tgt.addExtension(VERSION_EXTENSION_URL, String43_50.convertString(src.getVersionElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String43_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String43_50.convertString(src.getNameElement())); } if (src.hasTitle()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String43_50.convertString(src.getTitleElement())); + tgt.addExtension(TITLE_EXTENSION_URL, String43_50.convertString(src.getTitleElement())); } if (src.hasStatus()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.r4b.model.CodeType(src.getStatus().toCode())); + tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4b.model.CodeType(src.getStatus().toCode())); } if (src.hasExperimental()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean43_50.convertBoolean(src.getExperimentalElement())); + tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean43_50.convertBoolean(src.getExperimentalElement())); } if (src.hasDate()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime43_50.convertDateTime(src.getDateElement())); + tgt.addExtension(DATE_EXTENSION_URL, DateTime43_50.convertDateTime(src.getDateElement())); } if (src.hasPublisher()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String43_50.convertString(src.getPublisherElement())); + tgt.addExtension(PUBLISHER_EXTENSION_URL, String43_50.convertString(src.getPublisherElement())); } for (ContactDetail cd : src.getContact()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail43_50.convertContactDetail(cd)); + tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail43_50.convertContactDetail(cd)); } if (src.hasDescription()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown43_50.convertMarkdown(src.getDescriptionElement())); + tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getDescriptionElement())); } for (UsageContext cd : src.getUseContext()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext43_50.convertUsageContext(cd)); + tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext43_50.convertUsageContext(cd)); } for (CodeableConcept cd : src.getJurisdiction()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept43_50.convertCodeableConcept(cd)); + tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept43_50.convertCodeableConcept(cd)); } if (src.hasPurpose()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown43_50.convertMarkdown(src.getPurposeElement())); + tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getPurposeElement())); } if (src.hasCopyright()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown43_50.convertMarkdown(src.getCopyrightElement())); + tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown43_50.convertMarkdown(src.getCopyrightElement())); } if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String43_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String43_50.convertString(src.getCopyrightLabelElement())); } for (CanonicalType ref : src.getDerivedFrom()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Canonical43_50.convertCanonical(ref)); + tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical43_50.convertCanonical(ref)); } for (CanonicalType ref : src.getActor()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Canonical43_50.convertCanonical(ref)); + tgt.addExtension(ACTOR_EXTENSION_URL, Canonical43_50.convertCanonical(ref)); } for (RequirementsStatementComponent ref : src.getStatement()) { - org.hl7.fhir.r4b.model.Extension tgte = new org.hl7.fhir.r4b.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"); + org.hl7.fhir.r4b.model.Extension tgte = new org.hl7.fhir.r4b.model.Extension(REQUIREMENTS_STATEMENT_EXTENSION_URL); tgt.addExtension(tgte); convertRequirementsStatement(ref, tgte); } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Resource43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Resource43_50.java index bfceab044..141affaef 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Resource43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/Resource43_50.java @@ -10,6 +10,8 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Meta43_50; import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Narrative43_50; import org.hl7.fhir.exceptions.FHIRException; +import java.util.Arrays; + public class Resource43_50 { public final BaseAdvisor_43_50 advisor; @@ -512,7 +514,7 @@ public class Resource43_50 { } } - public void copyDomainResource(org.hl7.fhir.r4b.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource(org.hl7.fhir.r4b.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative43_50.convertNarrative(src.getText())); src.getContained().stream() @@ -523,7 +525,7 @@ public class Resource43_50 { org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension(); advisor.handleExtension(ConversionContext43_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext43_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext43_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension43_50.convertExtension(extension)); } }); @@ -533,7 +535,7 @@ public class Resource43_50 { .forEach(tgt::addModifierExtension); } - public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4b.model.DomainResource tgt) throws FHIRException { + public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4b.model.DomainResource tgt, String ... extensionUrlsToIgnore) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(Narrative43_50.convertNarrative(src.getText())); src.getContained().stream() @@ -544,7 +546,7 @@ public class Resource43_50 { org.hl7.fhir.r4b.model.Extension convertExtension = new org.hl7.fhir.r4b.model.Extension(); advisor.handleExtension(ConversionContext43_50.INSTANCE.path(), extension, convertExtension); tgt.addExtension(convertExtension); - } else if (!advisor.ignoreExtension(ConversionContext43_50.INSTANCE.path(), extension)) { + } else if (!advisor.ignoreExtension(ConversionContext43_50.INSTANCE.path(), extension) && !Arrays.asList(extensionUrlsToIgnore).contains(extension.getUrl())) { tgt.addExtension(Extension43_50.convertExtension(extension)); } }); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/SubscriptionTopic43_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/SubscriptionTopic43_50.java index 9f332f18a..2c4c421a4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/SubscriptionTopic43_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv43_50/resources43_50/SubscriptionTopic43_50.java @@ -14,6 +14,16 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class SubscriptionTopic43_50 { + + + public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name"; + public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyrightLabel"; + + private static final String[] IGNORED_EXTENSION_URLS = new String[]{ + NAME_EXTENSION_URL, + COPYRIGHT_LABEL_EXTENSION_URL + }; + public static org.hl7.fhir.r4b.model.SubscriptionTopic convertSubscriptionTopic(org.hl7.fhir.r5.model.SubscriptionTopic src) { if (src == null) return null; @@ -55,10 +65,10 @@ public class SubscriptionTopic43_50 { if (src.hasCopyright()) tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement())); if (src.hasCopyrightLabel()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyrightLabel", String43_50.convertString(src.getCopyrightLabelElement())); + tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String43_50.convertString(src.getCopyrightLabelElement())); } if (src.hasName()) { - tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name", String43_50.convertString(src.getNameElement())); + tgt.addExtension(NAME_EXTENSION_URL, String43_50.convertString(src.getNameElement())); } if (src.hasApprovalDate()) tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement())); @@ -243,13 +253,14 @@ public class SubscriptionTopic43_50 { return null; org.hl7.fhir.r5.model.SubscriptionTopic tgt = new org.hl7.fhir.r5.model.SubscriptionTopic(); ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyResource(src, tgt); - ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name")) { - tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name").getValue())); + ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); + + if (src.hasExtension(NAME_EXTENSION_URL)) { + tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); } - if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyrightLabel")) { - tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyrightLabel").getValue())); + if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { + tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); } if (src.hasUrl()) tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement())); diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_30/CapabilityStatement10_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_30/CapabilityStatement10_30Test.java new file mode 100644 index 000000000..b3ed1af23 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_30/CapabilityStatement10_30Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.convertors.conv10_30; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement10_30Test { + @Test + @DisplayName("Test dstu3 -> dstu2 CapabilityStatement conversion.") + public void testDstu3_Dstu2() throws IOException { + InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_30.json"); + + org.hl7.fhir.dstu3.model.CapabilityStatement dstu3 = (org.hl7.fhir.dstu3.model.CapabilityStatement) new org.hl7.fhir.dstu3.formats.JsonParser().parse(dstu3_input); + org.hl7.fhir.dstu2.model.Resource dstu2_conv = VersionConvertorFactory_10_30.convertResource(dstu3); + + org.hl7.fhir.dstu2.formats.JsonParser dstu2_parser = new org.hl7.fhir.dstu2.formats.JsonParser(); + + InputStream dstu2_input = this.getClass().getResourceAsStream("/conformance_30_10.json"); + org.hl7.fhir.dstu2.model.Conformance dstu2_actual = (org.hl7.fhir.dstu2.model.Conformance) dstu2_parser.parse(dstu2_input); + + assertTrue(dstu2_actual.equalsDeep(dstu2_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/CapabilityStatement10_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/CapabilityStatement10_40Test.java new file mode 100644 index 000000000..b44bb0185 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/CapabilityStatement10_40Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.convertors.conv10_40; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement10_40Test { + @Test + @DisplayName("Test r4 -> dstu2 CapabilityStatement conversion.") + public void testR4_Dstu2() throws IOException { + InputStream r4_input = this.getClass().getResourceAsStream("/capability_statement_50_with_30_extensions.json"); + + org.hl7.fhir.r4.model.CapabilityStatement r4_actual = (org.hl7.fhir.r4.model.CapabilityStatement) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input); + org.hl7.fhir.dstu2.model.Resource dstu2_conv = VersionConvertorFactory_10_40.convertResource(r4_actual); + + org.hl7.fhir.dstu2.formats.JsonParser dstu2_parser = new org.hl7.fhir.dstu2.formats.JsonParser(); + + InputStream dstu2_input = this.getClass().getResourceAsStream("/conformance_40_10.json"); + org.hl7.fhir.dstu2.model.Conformance dstu2_actual = (org.hl7.fhir.dstu2.model.Conformance) dstu2_parser.parse(dstu2_input); + + assertTrue(dstu2_actual.equalsDeep(dstu2_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_50/CapabilityStatement10_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_50/CapabilityStatement10_50Test.java new file mode 100644 index 000000000..f33384c97 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_50/CapabilityStatement10_50Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.convertors.conv10_50; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement10_50Test { + @Test + @DisplayName("Test r5 -> dstu2 CapabilityStatement conversion.") + public void testR5_Dstu2() throws IOException { + InputStream r5_input = this.getClass().getResourceAsStream("/capability_statement_50_with_30_extensions.json"); + + org.hl7.fhir.r5.model.CapabilityStatement r5_actual = (org.hl7.fhir.r5.model.CapabilityStatement) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); + org.hl7.fhir.dstu2.model.Resource dstu2_conv = VersionConvertorFactory_10_50.convertResource(r5_actual); + + org.hl7.fhir.dstu2.formats.JsonParser dstu2_parser = new org.hl7.fhir.dstu2.formats.JsonParser(); + + InputStream dstu2_input = this.getClass().getResourceAsStream("/conformance_50_10.json"); + org.hl7.fhir.dstu2.model.Conformance dstu2_actual = (org.hl7.fhir.dstu2.model.Conformance) dstu2_parser.parse(dstu2_input); + + assertTrue(dstu2_actual.equalsDeep(dstu2_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_30/CapabilityStatement14_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_30/CapabilityStatement14_30Test.java new file mode 100644 index 000000000..6b9971bea --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_30/CapabilityStatement14_30Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.convertors.conv14_30; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement14_30Test { + @Test + @DisplayName("Test r4 -> dstu2016 CapabilityStatement conversion.") + public void testDstu3_Dstu2016() throws IOException { + InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_30.json"); + + org.hl7.fhir.dstu3.model.CapabilityStatement dstu3 = (org.hl7.fhir.dstu3.model.CapabilityStatement) new org.hl7.fhir.dstu3.formats.JsonParser().parse(dstu3_input); + org.hl7.fhir.dstu2016may.model.Resource dstu2016_conv = VersionConvertorFactory_14_30.convertResource(dstu3); + + org.hl7.fhir.dstu2016may.formats.JsonParser dstu2016_parser = new org.hl7.fhir.dstu2016may.formats.JsonParser(); + + InputStream dstu2016_input = this.getClass().getResourceAsStream("/conformance_30_14.json"); + org.hl7.fhir.dstu2016may.model.Conformance dstu2016_actual = (org.hl7.fhir.dstu2016may.model.Conformance) dstu2016_parser.parse(dstu2016_input); + + assertTrue(dstu2016_actual.equalsDeep(dstu2016_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_40/CapabilityStatement14_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_40/CapabilityStatement14_40Test.java new file mode 100644 index 000000000..cb0b319ed --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_40/CapabilityStatement14_40Test.java @@ -0,0 +1,28 @@ +package org.hl7.fhir.convertors.conv14_40; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_40; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement14_40Test { + @Test + @DisplayName("Test r4 -> dstu2016 CapabilityStatement conversion.") + public void testR4_Dstu3() throws IOException { + InputStream r4_input = this.getClass().getResourceAsStream("/capability_statement_40_with_30_extensions.json"); + + org.hl7.fhir.r4.model.CapabilityStatement r4_actual = (org.hl7.fhir.r4.model.CapabilityStatement) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input); + org.hl7.fhir.dstu2016may.model.Resource dstu2016_conv = VersionConvertorFactory_14_40.convertResource(r4_actual); + + org.hl7.fhir.dstu2016may.formats.JsonParser dstu2016_parser = new org.hl7.fhir.dstu2016may.formats.JsonParser(); + + InputStream dstu2016_input = this.getClass().getResourceAsStream("/conformance_40_14.json"); + org.hl7.fhir.dstu2016may.model.Conformance dstu2016_actual = (org.hl7.fhir.dstu2016may.model.Conformance) dstu2016_parser.parse(dstu2016_input); + + assertTrue(dstu2016_actual.equalsDeep(dstu2016_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_50/CapabilityStatement14_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_50/CapabilityStatement14_50Test.java new file mode 100644 index 000000000..65d982174 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv14_50/CapabilityStatement14_50Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.convertors.conv14_50; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement14_50Test { + @Test + @DisplayName("Test r5 -> dstu2016 CapabilityStatement conversion.") + public void testR5_Dstu2016() throws IOException { + InputStream r5_input = this.getClass().getResourceAsStream("/capability_statement_50_with_30_extensions.json"); + + org.hl7.fhir.r5.model.CapabilityStatement r5_actual = (org.hl7.fhir.r5.model.CapabilityStatement) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); + org.hl7.fhir.dstu2016may.model.Resource dstu2016_conv = VersionConvertorFactory_14_50.convertResource(r5_actual); + + org.hl7.fhir.dstu2016may.formats.JsonParser dstu2016_parser = new org.hl7.fhir.dstu2016may.formats.JsonParser(); + + InputStream dstu2016_input = this.getClass().getResourceAsStream("/conformance_50_14.json"); + org.hl7.fhir.dstu2016may.model.Conformance dstu2016_actual = (org.hl7.fhir.dstu2016may.model.Conformance) dstu2016_parser.parse(dstu2016_input); + + assertTrue(dstu2016_actual.equalsDeep(dstu2016_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40Test.java new file mode 100644 index 000000000..7743da5b3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_40/CapabilityStatement30_40Test.java @@ -0,0 +1,28 @@ +package org.hl7.fhir.convertors.conv30_40; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement30_40Test { + @Test + @DisplayName("Test r4 -> dstu3 CapabilityStatement conversion.") + public void testR4_Dstu3() throws IOException { + InputStream r4_input = this.getClass().getResourceAsStream("/capability_statement_40_with_30_extensions.json"); + + org.hl7.fhir.r4.model.CapabilityStatement r5_actual = (org.hl7.fhir.r4.model.CapabilityStatement) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input); + org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_40.convertResource(r5_actual); + + org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser(); + + InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_40_30.json"); + org.hl7.fhir.dstu3.model.CapabilityStatement dstu3_actual = (org.hl7.fhir.dstu3.model.CapabilityStatement) dstu3_parser.parse(dstu3_input); + + assertTrue(dstu3_actual.equalsDeep(dstu3_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ActorDefinition30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ActorDefinition30_50Test.java index 10cfcba5e..4ccea65c2 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ActorDefinition30_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ActorDefinition30_50Test.java @@ -15,17 +15,17 @@ public class ActorDefinition30_50Test { @Test - @DisplayName("Test r5 -> r4 ActorDefinition conversion.") - public void testR5_R4() throws IOException { + @DisplayName("Test r5 -> dstu3 ActorDefinition conversion.") + public void testR5_dstu3() throws IOException { InputStream r5_input = this.getClass().getResourceAsStream("/actordefinition_50_example.json"); org.hl7.fhir.r5.model.ActorDefinition r5_actual = (org.hl7.fhir.r5.model.ActorDefinition) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); - org.hl7.fhir.dstu3.model.Resource r4_conv = VersionConvertorFactory_30_50.convertResource(r5_actual); + org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_50.convertResource(r5_actual); - org.hl7.fhir.dstu3.formats.XmlParser r4_parser = new org.hl7.fhir.dstu3.formats.XmlParser(); + org.hl7.fhir.dstu3.formats.XmlParser dstu3_parser = new org.hl7.fhir.dstu3.formats.XmlParser(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); - r4_parser.compose(stream, r4_conv); + dstu3_parser.compose(stream, dstu3_conv); org.hl7.fhir.dstu3.model.Resource r4_streamed = (org.hl7.fhir.dstu3.model.Basic) new org.hl7.fhir.dstu3.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray())); org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(r4_streamed); diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java new file mode 100644 index 000000000..095bfea3c --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java @@ -0,0 +1,28 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CapabilityStatement30_50Test { + @Test + @DisplayName("Test r5 -> dstu3 CapabilityStatement conversion.") + public void testR5_Dstu3() throws IOException { + InputStream r5_input = this.getClass().getResourceAsStream("/capability_statement_50_with_30_extensions.json"); + + org.hl7.fhir.r5.model.CapabilityStatement r5_actual = (org.hl7.fhir.r5.model.CapabilityStatement) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); + org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_50.convertResource(r5_actual); + + org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser(); + + InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_50_30.json"); + org.hl7.fhir.dstu3.model.CapabilityStatement dstu3_actual = (org.hl7.fhir.dstu3.model.CapabilityStatement) dstu3_parser.parse(dstu3_input); + + assertTrue(dstu3_actual.equalsDeep(dstu3_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50Test.java new file mode 100644 index 000000000..421e9677f --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50Test.java @@ -0,0 +1,34 @@ +package org.hl7.fhir.convertors.conv30_50; + +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ValueSet30_50Test { + @Test + @DisplayName("Test r5 -> dstu3 ValueSet conversion.") + public void testR5_Dstu3() throws IOException { + InputStream dstu3_input = this.getClass().getResourceAsStream("/valueset_30.json"); + + org.hl7.fhir.dstu3.model.ValueSet dstu3_actual = (org.hl7.fhir.dstu3.model.ValueSet) new org.hl7.fhir.dstu3.formats.JsonParser().parse(dstu3_input); + org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(dstu3_actual); + + org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser(); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + r5_parser.compose(stream, r5_conv); + + org.hl7.fhir.r5.model.Resource r5 = new org.hl7.fhir.r5.formats.JsonParser().parse(new ByteArrayInputStream(stream.toByteArray())); + org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_50.convertResource(r5); + + assertTrue(dstu3_actual.equalsDeep(dstu3_conv), "should be the same"); + } +} diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_30.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_30.json new file mode 100644 index 000000000..787c70c14 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/capability_statement_30.json @@ -0,0 +1,223 @@ +{ + "resourceType": "CapabilityStatement", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a \n general document profile.\n

\n\t\t
" + }, + "url": "urn:uuid:68D043B5-9ECF-4559-A57A-396E0D452311", + "version": "20130510", + "name": "ACME-EHR", + "title": "ACME EHR capability statement", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "code": { + "system": "http://hl7.org/fhir/usage-context-type", + "code": "focus" + }, + "valueCodeableConcept": { + "coding": [ + { + "system": "http://hl7.org/fhir/variant-state", + "code": "positive" + } + ] + } + } + ], + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "purpose": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "instantiates": [ + "http://ihe.org/fhir/CapabilityStatement/pixm-client" + ], + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "1.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "patchFormat": [ + "application/xml-patch+xml", + "application/json-patch+json" + ], + "implementationGuide": [ + "http://hl7.org/fhir/us/lab" + ], + "profile": [ + { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation", + "certificate": [ + { + "type": "application/jwt", + "blob": "IHRoaXMgYmxvYiBpcyBub3QgdmFsaWQ=" + } + ] + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://fhir.hl7.org/base/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "documentation": "This server does not let the clients create identities.", + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalRead": "full-support", + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "event": [ + { + "code": { + "system": "http://hl7.org/fhir/message-events", + "code": "admin-notify" + }, + "category": "Consequence", + "mode": "receiver", + "focus": "Patient", + "request": { + "reference": "StructureDefinition/Patient" + }, + "response": { + "reference": "StructureDefinition/MessageHeader" + }, + "documentation": "Notification of an update to a patient resource. changing the links is not supported" + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_30.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_30.json new file mode 100644 index 000000000..f444cd2b2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_30.json @@ -0,0 +1,207 @@ +{ + "resourceType": "CapabilityStatement", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a general document profile.\n

\n\t\t
" + }, + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "title": "ACME EHR capability statement", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "code": { + "system": "http://terminology.hl7.org/CodeSystem/usage-context-type", + "code": "focus" + }, + "valueCodeableConcept": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + } + } + ], + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "purpose": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "instantiates": [ + "http://ihe.org/fhir/CapabilityStatement/pixm-client" + ], + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "4.0.1", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "patchFormat": [ + "application/xml-patch+xml", + "application/json-patch+json" + ], + "implementationGuide": [ + "http://hl7.org/fhir/us/lab" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "documentation": "This server does not let the clients create identities.", + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalRead": "full-support", + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://terminology.hl7.org/CodeSystem/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "supportedMessage": [ + { + "mode": "receiver", + "definition": { + "reference": "http://hl7.org/fhir/MessageDefinition/example" + } + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_with_30_extensions.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_with_30_extensions.json new file mode 100644 index 000000000..af1adc1ee --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/capability_statement_40_with_30_extensions.json @@ -0,0 +1,204 @@ +{ + "resourceType": "CapabilityStatement", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a general document profile.\n

\n\t\t
" + }, + "extension": [ + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown", + "valueCode": "both" + } + ], + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "title": "ACME EHR capability statement", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "code": { + "system": "http://terminology.hl7.org/CodeSystem/usage-context-type", + "code": "focus" + }, + "valueCodeableConcept": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + } + } + ], + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "purpose": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "instantiates": [ + "http://ihe.org/fhir/CapabilityStatement/pixm-client" + ], + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "4.0.1", + "format": [ + "xml", + "json" + ], + "patchFormat": [ + "application/xml-patch+xml", + "application/json-patch+json" + ], + "implementationGuide": [ + "http://hl7.org/fhir/us/lab" + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416", + "supportedProfile": [ + "http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + ], + "documentation": "This server does not let the clients create identities.", + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalRead": "full-support", + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://terminology.hl7.org/CodeSystem/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "supportedMessage": [ + { + "mode": "receiver", + "definition": "http://hl7.org/fhir/MessageDefinition/example" + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + ] + } \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_30.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_30.json new file mode 100644 index 000000000..f63472eb8 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_30.json @@ -0,0 +1,210 @@ +{ + "resourceType": "CapabilityStatement", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t\n

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t\n

The EHR Application has a \n \n general document profile.\n \n

\n\t\t\n
" + }, + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "title": "ACME EHR capability statement", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "code": { + "system": "http://terminology.hl7.org/CodeSystem/usage-context-type", + "code": "focus" + }, + "valueCodeableConcept": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + } + } + ], + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "purpose": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "instantiates": [ + "http://ihe.org/fhir/CapabilityStatement/pixm-client" + ], + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "5.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "patchFormat": [ + "application/xml-patch+xml", + "application/json-patch+json" + ], + "implementationGuide": [ + "http://example.org/fhir/us/lab" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + }, + { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "documentation": "This server does not let the clients create identities.", + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalRead": "full-support", + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Patient:organization" + ], + "searchRevInclude": [ + "Person:patient" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "supportedMessage": [ + { + "mode": "receiver", + "definition": { + "reference": "http://hl7.org/fhir/MessageDefinition/example" + } + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_with_30_extensions.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_with_30_extensions.json new file mode 100644 index 000000000..663e8001b --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/capability_statement_50_with_30_extensions.json @@ -0,0 +1,215 @@ +{ + "resourceType": "CapabilityStatement", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t\n

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t\n

The EHR Application has a \n \n general document profile.\n \n

\n\t\t\n
" + }, + "extension": [ + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown", + "valueCode": "both" + }, + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", + "valueReference": { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + } + ], + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "title": "ACME EHR capability statement", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "code": { + "system": "http://terminology.hl7.org/CodeSystem/usage-context-type", + "code": "focus" + }, + "valueCodeableConcept": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + } + } + ], + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "purpose": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "instantiates": [ + "http://ihe.org/fhir/CapabilityStatement/pixm-client" + ], + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "5.0.0", + "format": [ + "xml", + "json" + ], + "patchFormat": [ + "application/xml-patch+xml", + "application/json-patch+json" + ], + "acceptLanguage": [ + "en", + "es" + ], + "implementationGuide": [ + "http://example.org/fhir/us/lab" + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416", + "supportedProfile": [ + "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + ], + "documentation": "This server does not let the clients create identities.", + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalRead": "full-support", + "conditionalUpdate": false, + "conditionalPatch": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Patient:organization" + ], + "searchRevInclude": [ + "Person:patient" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "supportedMessage": [ + { + "mode": "receiver", + "definition": "http://hl7.org/fhir/MessageDefinition/example" + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + ] +} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_30_10.json b/org.hl7.fhir.convertors/src/test/resources/conformance_30_10.json new file mode 100644 index 000000000..be6774a1b --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_30_10.json @@ -0,0 +1,184 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a \n general document profile.\n

\n\t\t
" + }, + "url": "urn:uuid:68D043B5-9ECF-4559-A57A-396E0D452311", + "version": "20130510", + "name": "ACME-EHR", + "status": "draft", + "experimental": true, + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "date": "2012-01-04", + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "1.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation", + "certificate": [ + { + "type": "application/jwt", + "blob": "IHRoaXMgYmxvYiBpcyBub3QgdmFsaWQ=" + } + ] + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://fhir.hl7.org/base/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "transactionMode": "transaction", + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "event": [ + { + "code": { + "system": "http://hl7.org/fhir/message-events", + "code": "admin-notify" + }, + "category": "Consequence", + "mode": "receiver", + "focus": "Patient", + "request": { + "reference": "StructureDefinition/Patient" + }, + "response": { + "reference": "StructureDefinition/MessageHeader" + }, + "documentation": "Notification of an update to a patient resource. changing the links is not supported" + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_30_14.json b/org.hl7.fhir.convertors/src/test/resources/conformance_30_14.json new file mode 100644 index 000000000..b0d0263b3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_30_14.json @@ -0,0 +1,202 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a \n general document profile.\n

\n\t\t
" + }, + "url": "urn:uuid:68D043B5-9ECF-4559-A57A-396E0D452311", + "version": "20130510", + "name": "ACME-EHR", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/variant-state", + "code": "positive" + } + ] + }, + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "1.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation", + "certificate": [ + { + "type": "application/jwt", + "blob": "IHRoaXMgYmxvYiBpcyBub3QgdmFsaWQ=" + } + ] + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://fhir.hl7.org/base/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications", + "event": [ + { + "code": { + "system": "http://hl7.org/fhir/message-events", + "code": "admin-notify" + }, + "category": "Consequence", + "mode": "receiver", + "focus": "Patient", + "request": { + "reference": "StructureDefinition/Patient" + }, + "response": { + "reference": "StructureDefinition/MessageHeader" + }, + "documentation": "Notification of an update to a patient resource. changing the links is not supported" + } + ] + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_40_10.json b/org.hl7.fhir.convertors/src/test/resources/conformance_40_10.json new file mode 100644 index 000000000..0893409b4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_40_10.json @@ -0,0 +1,168 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t\n

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t\n

The EHR Application has a \n \n general document profile.\n \n

\n\t\t\n
" + }, + "extension": [ + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", + "valueReference": { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + } + ], + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "status": "draft", + "experimental": true, + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "date": "2012-01-04", + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "5.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Patient:organization" + ], + "searchRevInclude": [ + "Person:patient" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "transactionMode": "transaction", + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications" + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_40_14.json b/org.hl7.fhir.convertors/src/test/resources/conformance_40_14.json new file mode 100644 index 000000000..2812f406e --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_40_14.json @@ -0,0 +1,178 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, update, history, search(name,gender), create and updates.

\n\t\t\t

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t

The EHR Application has a general document profile.\n

\n\t\t
" + }, + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + }, + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "4.0.1", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Organization" + ], + "searchRevInclude": [ + "Person" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://terminology.hl7.org/CodeSystem/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications" + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_50_10.json b/org.hl7.fhir.convertors/src/test/resources/conformance_50_10.json new file mode 100644 index 000000000..0893409b4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_50_10.json @@ -0,0 +1,168 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t\n

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t\n

The EHR Application has a \n \n general document profile.\n \n

\n\t\t\n
" + }, + "extension": [ + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", + "valueReference": { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + } + ], + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "status": "draft", + "experimental": true, + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "date": "2012-01-04", + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "5.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Patient:organization" + ], + "searchRevInclude": [ + "Person:patient" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "transactionMode": "transaction", + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications" + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/conformance_50_14.json b/org.hl7.fhir.convertors/src/test/resources/conformance_50_14.json new file mode 100644 index 000000000..b2a3c7f40 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/conformance_50_14.json @@ -0,0 +1,186 @@ +{ + "resourceType": "Conformance", + "id": "example", + "text": { + "status": "generated", + "div": "
\n\t\t\t

The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.

\n\t\t\t\n

The EHR System supports the following message: admin-notify::Person.

\n\t\t\t\n

The EHR Application has a \n \n general document profile.\n \n

\n\t\t\n
" + }, + "extension": [ + { + "url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", + "valueReference": { + "reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic" + } + } + ], + "url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311", + "version": "20130510", + "name": "ACMEEHR", + "status": "draft", + "experimental": true, + "date": "2012-01-04", + "publisher": "ACME Corporation", + "contact": [ + { + "name": "System Administrator", + "telecom": [ + { + "system": "email", + "value": "wile@acme.org" + } + ] + } + ], + "description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface", + "useContext": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/variant-state", + "code": "positive" + } + ] + }, + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US", + "display": "United States of America (the)" + } + ] + } + ], + "requirements": "Main EHR capability statement, published for contracting and operational support", + "copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems", + "kind": "instance", + "software": { + "name": "EHR", + "version": "0.00.020.2134", + "releaseDate": "2012-01-04" + }, + "implementation": { + "description": "main EHR at ACME", + "url": "http://10.2.3.4/fhir" + }, + "fhirVersion": "5.0.0", + "acceptUnknown": "both", + "format": [ + "xml", + "json" + ], + "profile": [ + { + "reference": "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347" + } + ], + "rest": [ + { + "mode": "server", + "documentation": "Main FHIR endpoint for acem health", + "security": { + "cors": true, + "service": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/restful-security-service", + "code": "SMART-on-FHIR" + } + ] + } + ], + "description": "See Smart on FHIR documentation" + }, + "resource": [ + { + "type": "Patient", + "profile": { + "reference": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416" + }, + "interaction": [ + { + "code": "read" + }, + { + "code": "vread", + "documentation": "Only supported for patient records since 12-Dec 2012" + }, + { + "code": "update" + }, + { + "code": "history-instance" + }, + { + "code": "create" + }, + { + "code": "history-type" + } + ], + "versioning": "versioned-update", + "readHistory": true, + "updateCreate": false, + "conditionalCreate": true, + "conditionalUpdate": false, + "conditionalDelete": "not-supported", + "searchInclude": [ + "Patient:organization" + ], + "searchRevInclude": [ + "Person:patient" + ], + "searchParam": [ + { + "name": "identifier", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier", + "type": "token", + "documentation": "Only supports search by institution MRN" + }, + { + "name": "general-practitioner", + "definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner", + "type": "reference" + } + ] + } + ], + "interaction": [ + { + "code": "transaction" + }, + { + "code": "history-system" + } + ], + "compartment": [ + "http://hl7.org/fhir/CompartmentDefinition/patient" + ] + } + ], + "messaging": [ + { + "endpoint": [ + { + "protocol": { + "system": "http://hl7.org/fhir/message-transport", + "code": "mllp" + }, + "address": "mllp:10.1.1.10:9234" + } + ], + "reliableCache": 30, + "documentation": "ADT A08 equivalent for external system notifications" + } + ], + "document": [ + { + "mode": "consumer", + "documentation": "Basic rules for all documents in the EHR system", + "profile": { + "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796" + } + } + ] +} diff --git a/org.hl7.fhir.convertors/src/test/resources/valueset_30.json b/org.hl7.fhir.convertors/src/test/resources/valueset_30.json new file mode 100644 index 000000000..59325d0f1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/valueset_30.json @@ -0,0 +1,52 @@ +{ + "resourceType": "ValueSet", + "id": "yesnodontknow", + "text": { + "status": "generated", + "div": "
\n

Value Set Contents

\n

This value set contains 3 concepts

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Code\n \n System\n \n Display\n \n Definition\n
\n \n Y\n http://hl7.org/fhir/v2/0136Yes\n
\n \n N\n http://hl7.org/fhir/v2/0136No\n
\n \n asked\n http://hl7.org/fhir/data-absent-reasonDon't knowThe source human does not know the value.
\n
" + }, + "url": "http://hl7.org/fhir/ValueSet/yesnodontknow", + "name": "Yes/No/Don't Know", + "status": "draft", + "description": "For Capturing simple yes-no-don't know answers", + "extensible": true, + "compose": { + "include": [ + { + "valueSet": [ + "http://hl7.org/fhir/ValueSet/v2-0136" + ] + }, + { + "system": "http://hl7.org/fhir/data-absent-reason", + "concept": [ + { + "code": "asked", + "display": "Don't know" + } + ] + } + ] + }, + "expansion": { + "identifier": "urn:uuid:bf99fe50-2c2b-41ad-bd63-bee6919810b4", + "timestamp": "2015-07-14T10:00:00Z", + "contains": [ + { + "system": "http://hl7.org/fhir/v2/0136", + "code": "Y", + "display": "Yes" + }, + { + "system": "http://hl7.org/fhir/v2/0136", + "code": "N", + "display": "No" + }, + { + "system": "http://hl7.org/fhir/data-absent-reason", + "code": "asked", + "display": "Don't know" + } + ] + } +} \ No newline at end of file